GravityView  2.10.1
The best, easiest way to display Gravity Forms entries on your website.
type_textarea.php
Go to the documentation of this file.
1 <?php
2 /**
3  * textarea input type
4  */
6 
7  function render_option() {
8 
9  ?>
10  <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
11 
12  echo '<span class="gv-label">'.$this->get_field_label().'</span>';
13  echo $this->get_tooltip() . $this->get_field_desc();
14  ?><div>
15  <?php $this->render_input(); ?>
16  </div>
17  </label>
18  <?php
19  }
20 
21  function render_input( $override_input = null ) {
22  if( isset( $override_input ) ) {
23  echo $override_input;
24  return;
25  }
26 
27  $class = 'widefat mt-wp_editor codemirror ';
28 
29  $show_mt = $this->show_merge_tags();
30 
31  if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32  $class .= ' merge-tag-support mt-position-right ';
33 
34  if( empty( $this->field['show_all_fields'] ) ) {
35  $class .= ' mt-hide_all_fields ';
36  }
37  }
38 
39  $class .= rgar( $this->field, 'class' );
40  $placeholder = rgar( $this->field, 'placeholder' );
41 
42  /**
43  * @since 1.22.5
44  */
45  $default_rows = apply_filters( 'gravityview/admin/field-types/textarea/rows', 5 );
46 
47  $rows = rgar( $this->field, 'rows', $default_rows );
48 
49 # $this->codemirror( $this->get_field_id() );
50 
51  ?>
52  <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea>
53  <?php
54  }
55 
56  function codemirror( $field_id = '' ) {
57 
58  // Enqueue code editor and settings for manipulating HTML.
59  $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
60 
61  // Bail if user disabled CodeMirror.
62  if ( false === $settings ) {
63  return;
64  }
65 
66  ?>
67 
68  <script>
69  wp.codeEditor.initialize( "<?php echo $field_id;?>", {});
70  </script>
71  <?php
72  }
73 
74 }
show_merge_tags()
Verify if field should have merge tags.
get_field_desc()
Retrieve field description.
render_input( $override_input=null)
$class
$field_id
Definition: time.php:17
Modify option field type by extending this class.
if(empty( $field_settings['email_field'])) $settings