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() { $defaults = array( 'show' => array( 'title' => true, 'description' => true, 'url' => true, ), 'content_title' => __ ( 'Icon', 'ascend' ) ); $this->field = wp_parse_args ( $this->field, $defaults ); echo '
'; $x = 0; $multi = (isset($this->field['multi']) && $this->field['multi']) ? ' multiple="multiple"' : ""; if (isset($this->value) && is_array($this->value)) { $slides = $this->value; foreach ($slides as $slide) { if ( empty( $slide ) ) { continue; } $defaults = array( 'icon_o' => '', 'title' => '', 'description' => '', 'sort' => '', 'target' => '', 'link' => '', 'url' => '', 'thumb' => '', 'image' => '', 'attachment_id' => '', 'height' => '', 'width' => '', 'select' => array(), ); $slide = wp_parse_args( $slide, $defaults ); if (empty($slide['url']) && !empty($slide['attachment_id'])) { $img = wp_get_attachment_image_src($slide['attachment_id'], 'full'); $slide['url'] = $img[0]; $slide['width'] = $img[1]; $slide['height'] = $img[2]; } echo '

' . esc_html($slide['title']) . '

'; $hide = ''; if ( empty( $slide['url'] ) ) { $hide = ' hide'; } echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '' . __('Upload Icon', 'ascend') . ''; $hide = ''; if (empty($slide['url']) || $slide['url'] == '') $hide = ' hide'; echo '' . __('Remove', 'ascend') . ''; echo '
' . "\n"; $icon_option = ascend_icon_list(); $placeholder = (isset($this->field['placeholder']['icon_o'])) ? esc_attr($this->field['placeholder']['icon_o']) : __( 'Select an Icon', 'ascend' ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( esc_attr( $this->field['select2'] ) ); $select2_params = htmlspecialchars( $select2_params , ENT_QUOTES); echo ''; } echo ''; echo '
    '; echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo ''; echo ''; echo ''; echo '
  • '; echo '
  • ' . __('Delete Icon', 'ascend') . '
  • '; echo '
'; $x++; } } if ($x == 0) { echo '

New Icon

'; $hide = ' hide'; echo '
'; echo ''; echo ''; echo ''; echo '
'; //Upload controls DIV echo '
'; //If the user has WP3.5+ show upload/remove button echo '' . __('Upload Icon', 'ascend') . ''; echo '' . __('Remove', 'ascend') . ''; echo '
' . "\n"; $icon_option = ascend_icon_list(); $placeholder = (isset($this->field['placeholder']['icon_o'])) ? esc_attr($this->field['placeholder']['icon_o']) : __( 'Select an Icon', 'ascend' ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( esc_attr( $this->field['select2'] ) ); $select2_params = htmlspecialchars( $select2_params , ENT_QUOTES); echo ''; } echo ''; echo '
    '; $placeholder = (isset($this->field['placeholder']['url'])) ? esc_attr($this->field['placeholder']['url']) : __( 'URL', 'ascend' ); echo '
  • '; $placeholder = (isset($this->field['placeholder']['title'])) ? esc_attr($this->field['placeholder']['title']) : __( 'Title', 'ascend' ); echo '
  • '; $placeholder = (isset($this->field['placeholder']['description'])) ? esc_attr($this->field['placeholder']['description']) : __( 'Description', 'ascend' ); echo '
  • '; $placeholder = (isset($this->field['placeholder']['link'])) ? esc_attr($this->field['placeholder']['link']) : __( 'Icon Link', 'ascend' ); echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo ''; echo ''; echo '
  • '; echo '
  • ' . __('Delete Icon', 'ascend') . '
  • '; echo '
'; } echo '
' . __('Add Icon', 'ascend') . '
'; } public function enqueue () { if ( function_exists( 'wp_enqueue_media' ) ) { wp_enqueue_media(); } else { wp_enqueue_script( 'media-upload' ); } wp_enqueue_script ( 'redux-field-media-js', ReduxFramework::$_url . 'assets/js/media/media' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time (), true ); wp_enqueue_script ( 'kad-field-icons-js', //get_template_directory_uri() . '/themeoptions/options/extensions/kad_icons/kad_icons/field_kad_icons' . Redux_Functions::isMin () . '.js', get_template_directory_uri() . '/themeoptions/options/extensions/kad_icons/kad_icons/field_kad_icons.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'wp-color-picker' ), time (), true ); wp_enqueue_style ( 'kad-field-icons-css', get_template_directory_uri() . '/themeoptions/options/extensions/kad_icons/kad_icons/field_kad_icons.css', time (), true ); } } }