46 $this->template_id = $id;
51 $this->active_areas = $areas;
63 add_filter(
'gravityview_register_directory_template', array( $this,
'register_template' ) );
67 add_filter(
'gravityview_template_formxml', array( $this,
'assign_form_xml' ), 10, 2 );
69 add_filter(
'gravityview_template_fieldsxml', array( $this,
'assign_fields_xml' ), 10, 2 );
72 add_filter(
'gravityview_template_active_areas', array( $this,
'assign_active_areas' ), 10, 3 );
75 add_filter(
'gravityview_template_field_options', array( $this,
'assign_field_options' ), 10, 5 );
78 add_filter(
"gravityview_template_slug_{$this->template_id}", array( $this,
'assign_view_slug' ), 10, 2 );
81 add_action(
'wp_enqueue_scripts', array( $this,
'register_styles' ) );
105 'preset_fields' =>
'' 108 $this->settings = wp_parse_args(
$settings, $defaults );
140 if ( $this->template_id ===
$template ) {
148 if ( isset( $this->active_areas[ $context ] ) ) {
149 return $this->active_areas[ $context ];
170 foreach ( $this->field_options as $key => $field_option ) {
176 $context_matches = is_array( $field_context ) ? in_array( $context, $field_context ) : $context === $field_context;
179 if ( $context_matches ) {
196 if ( $this->settings[
'type'] ===
'preset' && ! empty( $this->settings[
'preset_form'] ) && $this->template_id ===
$template ) {
197 return $this->settings[
'preset_form'];
210 if ( $this->settings[
'type'] ===
'preset' && ! empty( $this->settings[
'preset_fields'] ) && $this->template_id ===
$template ) {
211 return $this->settings[
'preset_fields'];
229 if ( ! empty( $this->settings[
'slug'] ) ) {
230 return $this->settings[
'slug'];
232 if ( ! empty( $default ) ) {
247 if ( ! empty( $this->settings[
'css_source'] ) ) {
248 wp_register_style(
'gravityview_style_' . $this->template_id, $this->settings[
'css_source'], array(),
GV_PLUGIN_VERSION,
'all' );
const GV_PLUGIN_VERSION(! GravityKit\GravityView\Foundation\meets_min_php_version_requirement(__FILE__, '7.2.0'))
Constants.
merge_defaults( $settings=array())
Merge the template settings with the default settings.
register_styles()
If the template has a CSS file defined in the css_source setting, register it It will be registered u...
if(! isset( $gravityview)||empty( $gravityview->template)) $template
The entry loop for the list output.
assign_field_options( $field_options, $template_id, $field_id=NULL, $context='directory', $input_type='')
Assign template specific field options.
Class used to register a new template to be shown in GravityView presets.
assign_view_slug( $default, $context)
Assign the template slug when loading the presentation template (frontend)
register_template( $templates)
Register the template to display in the admin.
get_active_areas( $context)
assign_fields_xml( $xml='', $template='')
Set the Gravity Forms import form by using the preset_fields field defined in the template...
assign_active_areas( $areas, $template='', $context='directory')
Assign active areas (for admin configuration)
add_hooks()
Add filters and actions for the templates.
assign_form_xml( $xml='', $template='')
Set the Gravity Forms import form information by using the preset_form field defined in the template...
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
__construct( $id, $settings=array(), $field_options=array(), $areas=array())
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed