. * * @package ReduxFramework * @subpackage Field_Info * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @author Abdullah Almesbahi * @author Jesús Mendoza (@vertigo7x) * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) exit; // Don't duplicate me! if (!class_exists('ReduxFramework_group')) { /** * Main ReduxFramework_info class * * @since 1.0.0 */ class ReduxFramework_group extends ReduxFramework { /** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value ='', $parent ) { //parent::__construct( $parent->sections, $parent->args ); $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { if ( isset( $this->field['subfields'] ) && empty( $this->field['fields'] ) ) { $this->field['fields'] = $this->field['subfields']; unset( $this->field['subfields'] ); } if (empty($this->value) || !is_array($this->value)) { $this->value = array( array( 'slide_title' => __('New', 'redux-framework').' '.$this->field['groupname'], 'slide_sort' => '0', ) ); } $groups = $this->value; echo '
';
if(isset($field['class']))
$field['class'] .= " group";
else
$field['class'] = " group";
if (!empty($field['title']))
echo '' . $field['title'] . ''; if (!empty($field['subtitle'])) echo '' . $field['subtitle'] . ''; if (isset($group[$field['id']]) && !empty($group[$field['id']])) { $value = $group[$field['id']]; } $value = empty($value) ? "" : $value; ob_start(); $this->_field_input($field, $value); //if (isset($this->options[$field['id']]) && !empty($this->options[$field['id']]) && is_array($this->options[$field['id']])) { // $value = next($this->options[$field['id']]); //} $content = ob_get_contents(); //adding sorting number to the name of each fields in group $name = '[' . $field['id'] . ']'; $content = str_replace($name, $this->parent->args['opt_name'] . '[' . $this->field['id'] . ']['.$x.']['.$field['id'].']', $content); //we should add $sort to id to fix problem with select field $content = str_replace(' id="'.$field['id'].'-select"', ' id="'.$field['id'].'-select-'.$sort.'"', $content); if(($field['type'] === "text") && ($field_is_title)) { $content = str_replace('>', 'data-title="true" />', $content); $field_is_title = false; } $_field = apply_filters('redux-support-group',$content, $field, $x); ob_end_clean(); echo $_field; echo ' |