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
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
$author
protected
string
$author
$category
protected
string
$category
$customContent
protected
string|null
$customContent
$date
protected
string
$date
$description
protected
string
$description
$identifier
protected
string
$identifier
$title
protected
string
$title
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.
getIdentifier()
public
getIdentifier() : string
Return values
stringsave()
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
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.