class CreateTemplate

Processes the wp gpdf create-template WP CLI Command

Methods

__construct(string $workingDirectory, object $cli)

No description

__invoke(array $templateArray, array $args = [])

Generates a PDF template in the PDF Working Directory

Details

at line 64
__construct(string $workingDirectory, object $cli)

Parameters

string $workingDirectory The absolute path to the PDF Working Directory
object $cli The WP_CLI class, or a suitable drop-in replacement (for testing)

at line 110
__invoke(array $templateArray, array $args = [])

Generates a PDF template in the PDF Working Directory

OPTIONS

The name of the PDF template you'd like to create.
[--enable-config]
When included, a configuration file will be created alongside your template
[--enable-toolkit]
When included, the Dev Toolkit classes will be injected into your PDF template and the sandbox disabled.
[--skip-headers]
When included, we will not ask you any additional questions about the PDF template.

EXAMPLES

# Create a PDF template called 'my-custom-template.php'
$ wp gpdf create-template "My Custom Template"

# Create a PDF template called 'my-custom-template.php', as well as an associated config file '/config/my-custom-template.php'
$ wp gpdf create-template "My Custom Template" --enable-config

# Create a PDF template called 'my-custom-template.php' using the Toolkit
$ wp gpdf create-template "My Custom Template" --enable-toolkit

# Create a PDF template called 'my-custom-template.php' using the Toolkit, as well as an associated config file '/config/my-custom-template.php'
$ wp gpdf create-template "My Custom Template" --enable-config --enable-toolkit

# Create a PDF template called 'my-custom-template.php' without asking any additional questions about the template
$ wp gpdf create-template "My Custom Template" --skip-headers

Parameters

array $templateArray The PDF Template Name the use has entered. If they used quotes it'll be an array with one element, otherwise each space will signify a new array element.
array $args The additional arguments passed to the cli. May include enable-config, enable-toolkit and skip-headers

Exceptions

Exception