API Documentation

CreatesNewMarkdownPostFile
in package

Offloads logic for the make:post command.

This class is executed when creating a new Markdown Post using the Hyde command, and converts and formats the data input by the user, and then saves the file.

Tags
see
MakePostCommand

Table of Contents

Properties

$author  : string
$category  : string
$customContent  : string|null
$date  : string
$description  : string
$identifier  : string
$title  : string

Methods

__construct()  : mixed
Construct the class.
getIdentifier()  : string
save()  : string
Save the class object to a Markdown file.
toArray()  : array{title: string, description: string, category: string, author: string, date: string}
Get the class data as an array.

Properties

Methods

__construct()

Construct the class.

public __construct(string $title, string|null $description, string|null $category, string|null $author[, string|null $date = null ][, string|null $customContent = null ]) : mixed
Parameters
$title : string

The Post Title.

$description : string|null

The Post Meta Description.

$category : string|null

The Primary Post Category.

$author : string|null

The Username of the Author.

$date : string|null = null

Optionally specify a custom date.

$customContent : string|null = null

Optionally specify custom post content.

save()

Save the class object to a Markdown file.

public save([bool $force = false ]) : string
Parameters
$force : bool = false

Should the file be created even if a file with the same path already exists?

Tags
throws
FileConflictException

if a file with the same identifier already exists and the force flag is not set.

Return values
string

Returns the path to the created file.

toArray()

Get the class data as an array.

public toArray() : array{title: string, description: string, category: string, author: string, date: string}

The identifier property is removed from the array as it can't be set in the front matter.

Return values
array{title: string, description: string, category: string, author: string, date: string}

        
On this page

Search results