16 var
$contexts = array(
'single',
'multiple',
'edit' );
32 var
$icon =
'dashicons-editor-code';
36 $this->label = esc_html__(
'Custom Content',
'gk-gravityview' );
37 $this->
description = esc_html__(
'Insert custom text or HTML.',
'gk-gravityview' );
39 add_filter(
'gravityview/edit_entry/form_fields', array( $this,
'show_field_in_edit_entry' ), 10, 4 );
41 add_filter(
'gravityview_entry_default_fields', array( $this,
'add_default_field' ), 100, 3 );
43 parent::__construct();
59 $entry_default_fields[
'custom'] = array(
60 'label' => $this->label,
61 'type' => $this->name,
63 'icon' => $this->icon,
64 'group' => $this->group,
67 return $entry_default_fields;
72 unset ( $field_options[
'search_filter'], $field_options[
'show_as_link'], $field_options[
'new_window'] );
77 'label' => __(
'Custom Content',
'gk-gravityview' ),
78 'desc' => sprintf( __(
'Enter text or HTML. Also supports shortcodes. You can show or hide data using the %s shortcode (%slearn more%s).',
'gk-gravityview' ),
'<code>[gvlogic]</code>',
'<a href="https://docs.gravityview.co/article/252-gvlogic-shortcode" data-beacon-article-sidebar="552355bfe4b0221aadf2572b">',
'</a>' ) .
' ' . sprintf( __(
'Click the arrow icon next to the content area to add %sMerge Tags%s.',
'gk-gravityview' ),
'<a href="https://docs.gravityview.co/article/76-merge-tags" data-beacon-article-inline="54c67bbbe4b051242988551d">',
'</a>' ),
81 'merge_tags' =>
'force',
83 'show_all_fields' =>
true,
89 'label' => __(
'Automatically add paragraphs to content',
'gk-gravityview' ),
90 'tooltip' => __(
'Wrap each block of text in an HTML paragraph tag (recommended for text).',
'gk-gravityview' ),
97 'label' => __(
'Render oEmbeds',
'gk-gravityview' ),
98 'desc' => sprintf( _x(
'Automatically convert oEmbed URLs into embedded content (%slearn more%s).',
'HTML link pointing to WordPress article on oEmbed',
'gk-gravityview' ),
'<a href="https://codex.wordpress.org/Embeds" rel="external noopener noreferrer">',
'</a>' ),
103 'admin_label' => array(
105 'class' =>
'widefat',
106 'label' => __(
'Admin Label',
'gk-gravityview' ),
107 'desc' => __(
'A label that is only shown in the GravityView View configuration screen.',
'gk-gravityview' ),
114 if (
'edit' === $context ) {
115 unset( $field_options[
'custom_label'], $field_options[
'show_label'], $field_options[
'allow_edit_cap'], $new_fields[
'wpautop'], $new_fields[
'oembed'] );
118 return $new_fields + $field_options;
138 if ( is_null( $edit_fields ) ) {
142 $new_fields = array();
149 foreach ( (array) $edit_fields as $id => $edit_field ) {
150 if (
'custom' === \
GV\Utils::get( $edit_field,
'id' ) ) {
153 'label' => \
GV\Utils::get( $edit_field,
'custom_label' ),
154 'customLabel' => \
GV\Utils::get( $edit_field,
'custom_label' ),
155 'content' => \
GV\Utils::get( $edit_field,
'content' ),
159 foreach ( $field_data as $key => $field_datum ) {
164 $field_data[
'cssClass'] =
\GV\Utils::get( $edit_field,
'custom_class' );
166 $new_fields[] =
new GF_Field_HTML( $field_data );
169 if( isset( $fields[
$i ] ) ) {
170 $new_fields[] = $fields[
$i ];
Modify field settings by extending this class.
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
new GravityView_Field_Custom
if(gravityview() ->plugin->is_GF_25()) $form
scale description p description
Add custom options for Code field.
if(empty( $created_by)) $form_id
add_default_field( $entry_default_fields, $form=array(), $zone='')
Add as a default field, outside those set in the Gravity Form form.
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
gravityview()
The main GravityView wrapper function.
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
show_field_in_edit_entry( $fields, $edit_fields=null, $form=array(), $view_id=0)
Adds the GravityView Custom Content field to the Edit Entry form.