/**
  * Render the field inner content.
  *
  * @since 0.1.0
  * @param Ev_Field $field A field object.
  */
 public function render_inner($field = false)
 {
     $field_types = ev_field_types();
     $value = $this->value();
     $handle = $this->handle();
     if ($field !== false) {
         $value = $field->value();
         $handle = $field->handle();
     }
     echo '<div class="ev-bundle-fields-wrapper">';
     echo '<div class="ev-field-panel-controls-wrapper">';
     echo '<div class="ev-field-panel-controls-inner-wrapper">';
     echo '<span class="ev-repeatable-remove"></span>';
     echo '<span class="ev-sortable-handle"></span>';
     echo '</div>';
     echo '</div>';
     if (!ev_is_skipped_on_saving($this->_type)) {
         $this->_render_repeatable_controls('prepend', 'medium');
     }
     foreach ($this->_fields as $index => $field_data) {
         $field_class = $field_types[$field_data['type']];
         $field_data['bundle'] = $handle;
         $fld = new $field_class($field_data);
         if (isset($value[$field_data['handle']])) {
             $fld->value($value[$field_data['handle']]);
         }
         $fld->render();
     }
     if (!ev_is_skipped_on_saving($this->_type)) {
         $this->_render_repeatable_controls('append', 'medium');
     }
     echo '</div>';
 }
 /**
  * Constructor for the checkbox field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     parent::__construct($data);
 }
 /**
  * Constructor for the divider field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     $this->_text = $data['text'];
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('style' => 'section_break'));
     parent::__construct($data);
 }
 /**
  * Constructor for the color field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('multiple' => false, 'palette' => false));
     parent::__construct($data);
 }
 /**
  * Constructor for the textarea field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('rows' => '2', 'cols' => '20', 'rich' => false, 'full' => false));
     parent::__construct($data);
 }
 /**
  * Constructor for the number field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('step' => '', 'min' => '', 'max' => ''));
     parent::__construct($data);
 }
Exemplo n.º 7
0
 /**
  * Constructor for the date field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('style' => '', 'size' => '', 'format' => 'yy-mm-dd'));
     parent::__construct($data);
 }
 /**
  * Constructor for the image field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('multiple' => false, 'sortable' => false, 'breakpoints' => false, 'density' => false, 'image_size' => false, 'thumb_size' => 'medium'));
     parent::__construct($data);
 }
 /**
  * Constructor for the text field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('vertical' => false, 'data' => array(), 'max' => false, 'create' => false));
     parent::__construct($data);
 }
 /**
  * Constructor for the radio field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('graphic' => false, 'data' => array()));
     parent::__construct($data);
 }
Exemplo n.º 11
0
 /**
  * Constructor for the text field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('style' => '', 'size' => '', 'full' => false, 'link' => false));
     parent::__construct($data);
 }
Exemplo n.º 12
0
 /**
  * Constructor for the icon field class.
  *
  * @since 0.1.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     // $data['config'] = wp_parse_args( $data['config'], array(
     // 	'size' => ''
     // ) );
     parent::__construct($data);
 }
 /**
  * Constructor for the attachment field class.
  *
  * @since 0.4.0
  * @param array $data The field data structure.
  */
 public function __construct($data)
 {
     if (!isset($data['default'])) {
         $data['default'] = '';
     }
     if (!isset($data['config'])) {
         $data['config'] = array();
     }
     $data['config'] = wp_parse_args($data['config'], array('type' => '', 'multiple' => false, 'sortable' => false, 'thumb_size' => 'medium'));
     if (!in_array($data['config']['type'], array('', 'image', 'audio', 'video', 'application'))) {
         $data['config']['type'] = '';
     }
     parent::__construct($data);
 }
 /**
  * Render the field inner content.
  *
  * @since 0.1.0
  * @param Ev_Field $field A field object.
  */
 public function render_inner($field = false)
 {
     $field_types = ev_field_types();
     $value = $this->value();
     $handle = $this->handle();
     if ($field !== false) {
         $value = $field->value();
         $handle = $field->handle();
     }
     echo '<div class="ev-bundle-fields-wrapper">';
     echo '<span class="ev-sortable-handle"></span>';
     foreach ($this->_fields as $index => $field_data) {
         $field_class = $field_types[$field_data['type']];
         $field_data['bundle'] = $handle;
         $fld = new $field_class($field_data);
         if (isset($value[$field_data['handle']])) {
             $fld->value($value[$field_data['handle']]);
         }
         $fld->render();
     }
     echo '<span class="ev-repeatable-remove"></span>';
     echo '</div>';
 }
 /**
  * When the post is saved, save a single custom data contained in the meta box.
  *
  * @since 0.1.0
  * @param int $post_id The ID of the post being saved.
  * @param array $element The element structure.
  * @param string|array $element_value The element value.
  */
 private function _save_single_field($post_id, $element, $value)
 {
     /* Escaping user-inserted slashes. */
     $value = str_replace('\\', '\\\\', $value);
     /* Sanitizing the field value. */
     $value = Ev_Field::sanitize($element, $value);
     update_post_meta($post_id, $element['handle'], $value);
 }
Exemplo n.º 16
0
 /**
  * When the page or tab is saved, save a single custom option contained in the page or tab.
  *
  * @since 0.1.0
  * @param array $element The element structure.
  * @param string|array $element_value The element value.
  */
 protected function _save_single_field($element, $value)
 {
     $value = Ev_Field::sanitize($element, $value);
     ev_update_option($element['handle'], $value);
 }