Skip to content

Instantly share code, notes, and snippets.

@jakejackson1 jakejackson1/hello-world.php Secret
Last active Feb 22, 2016

Embed
What would you like to do?
The completed template configuration for our Hello World tutorial
<?php
namespace GFPDF\Templates\Config;
use GFPDF\Helper\Helper_Interface_Config;
/**
* Configuration file for hello-world.php
*/
/* Exit if accessed directly */
if ( ! defined('ABSPATH') ) {
exit;
}
/**
* The configuration class name should be the same name as the PHP template file name with the following modifications:
* The file extension is omitted (.php)
* Any hyphens (-) should be replaced with underscores (_)
* The class name should be in sentence case (the first character of each word separated by a hyphen (-) or underscore (_) should be uppercase)
*
* For instance, a template called core-simple.php or core_simple.php would have a configuration class of "Core_Simple"
*
* This naming convention is very important, otherwise the software cannot correctly load the configuration
*/
class Hello_World implements Helper_Interface_Config {
/**
* Return the templates configuration structure which control what extra fields will be shown in the "Template" tab when configuring a form's PDF.
*
* @return array The array, split into core components and custom fields
*
* @since 4.0
*/
public function configuration() {
return array(
'core' => array(
'footer' => true,
'background_image' => true,
),
'fields' => array(
'world_show_meta_data' => array(
'id' => 'world_show_meta_data',
'name' => __( 'Show Meta Data', 'world-pdf-template'),
'desc' => __( 'When enabled the user IP, timestamp, user agent and source URL will be included in the PDF.', 'world-pdf-template' ),
'type' => 'radio',
'options' => array(
'Yes' => __( 'Yes', 'world-pdf-template' ),
'No' => __( 'No', 'world-pdf-template' ),
),
'std' => __( 'No', 'world-pdf-template' )
)
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.