GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-post-content.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-post-content.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
9 
10  var $name = 'post_content';
11 
12  var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
13 
14  var $_gf_field_class_name = 'GF_Field_Post_Content';
15 
16  var $group = 'post';
17 
18  public function __construct() {
19  $this->label = esc_html__( 'Post Content', 'gravityview' );
20  parent::__construct();
21  }
22 
23  function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24 
25  unset( $field_options['show_as_link'] );
26 
27  if( 'edit' === $context ) {
28  return $field_options;
29  }
30 
31  $this->add_field_support('dynamic_data', $field_options );
32 
33  return $field_options;
34  }
35 
36  /**
37  * Returns the field inner markup.
38  *
39  * @param array $form The Form Object currently being processed.
40  * @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission.
41  * @param null|array $entry Null or the Entry Object currently being edited.
42  *
43  * @return string
44  */
45  public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field ) {
46 
47  $id = (int) $field->id;
48  $input_name = "input_{$id}";
49  $class = esc_attr( $field->size );
50  $tabindex = $field->get_tabindex();
51 
52  $editor_settings = array(
53  'editor_class' => "textarea {$class}",
54  'textarea_name' => $input_name,
55  'textarea_rows' => 15,
56  'tabindex' => $tabindex,
57  'media_buttons' => false,
58  'quicktags' => false,
59  'logic_event' => $field->get_conditional_logic_event( 'keyup' ),
60  'placeholder' => $field->get_field_placeholder_attribute(),
61  );
62 
63  /**
64  * @filter `gravityview/edit_entry/post_content/wp_editor_settings` Modify the settings passed to the Post Content wp_editor()
65  * @see wp_editor() For the options available
66  * @since 1.7
67  * @param array $editor_settings Array of settings to be passed to wp_editor(). Note: there are also two additional values in the array: `logic_event` and `placehodler`, added to the textarea HTML by GravityView.
68  */
69  $editor_settings = apply_filters( 'gravityview/edit_entry/post_content/wp_editor_settings', $editor_settings );
70 
71  ob_start();
72  wp_editor( $value, $input_name, $editor_settings );
73  $editor = ob_get_clean();
74 
75  $logic_event = rgar( $editor_settings, 'logic_event' );
76  $placeholder = rgar( $editor_settings, 'placeholder' );
77 
78  /** @internal Instead of using `add_filter('the_editor')` and doing the same thing, it's cleaner here. */
79  $editor = str_replace( '<textarea ', "<textarea {$logic_event} {$placeholder}", $editor );
80 
81  return sprintf( "<div class='ginput_container ginput_container_post_content'>%s</div>", trim( $editor ) );
82  }
83 
84 }
85 
Modify field settings by extending this class.
$search_operators
$group
__construct()
$class
new GravityView_Field_Post_Content
add_field_support($key= '', &$field_options)
get_field_input($form, $value= '', $entry=null, GF_Field_Post_Content $field)
Returns the field inner markup.
$name
$_gf_field_class_name
$field_id
Definition: time.php:17
field_options($field_options, $template_id, $field_id, $context, $input_type)
$entry
Definition: notes.php:27
$field
Definition: gquiz_grade.php:11