. * * @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 { /** * 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() { print_r($this->value); if ( isset( $this->field['subfields'] ) && empty( $this->field['fields'] ) ) { $this->field['fields'] = $this->field['subfields']; unset( $this->field['subfields'] ); } $groups = $this->value; if (!isset($this->field['groupname'])) { $this->field['groupname'] = ""; } echo '
'; // Create dummy content for the adding new ones echo ''; echo '
' . __('Add', 'redux-framework') .' '.$this->field['groupname']. '
'; //echo ''; } function support_multi($content, $field, $sort) { //convert name $name = $this->parent->args['opt_name'] . '[' . $field['id'] . ']'; $content = str_replace($name, $name . '[' . $sort . ']', $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); return $content; } /** * Enqueue Function. * * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { wp_enqueue_script( 'redux-field-group-js', ReduxFramework::$_url . 'inc/fields/group/field_group.js', array('jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'wp-color-picker'), time(), true ); wp_enqueue_style( 'redux-field-group-css', ReduxFramework::$_url . 'inc/fields/group/field_group.css', time(), true ); } public function enqueue_dependencies($field_type) { $field_class = 'ReduxFramework_' . $field_type; if (!class_exists($field_class)) { $class_file = apply_filters('redux-typeclass-load', ReduxFramework::$_dir . 'inc/fields/' . $field_type . '/field_' . $field_type . '.php', $field_class); if ($class_file) { /** @noinspection PhpIncludeInspection */ require_once( $class_file ); } } if (class_exists($field_class) && method_exists($field_class, 'enqueue')) { $enqueue = new $field_class('', '', $this); $enqueue->enqueue(); } } } }