Custom addon for child elements is not displaying correctly
-
Hi Guys,
Based on your documentation, I’m trying to create some extra page elements, one of ’em is based on a Parent and Child element, everything is saving and displaying correclty in the frontend, but in the backend the titles of the child items don’t seem to change, they stay on their original value. The weird thing though is that whenever I click to the Shortcode tab, the content there shows correctly. I compared your builtin elements with my code and I can’t see anything wrong. And the builtin elements work perfeclty.
What am I doing wrong? Is it perhaps a bug?
The custom Parent class
class IG_funfacts extends IG_Pb_Shortcode_Parent { public function __construct() { parent::__construct(); } /** * Configure the custom page element **/ public function element_config() { $this->config['shortcode'] = strtolower(__CLASS__); $this->config['name'] = __('Fun Facts', IGPBL ); $this->config['has_subshortcode'] = 'IG_Item_' . str_replace( 'IG_', '', __CLASS__ ); $this->config['edit_using_ajax'] = false; } /** * Create all the custom fields and inputs for the custom page element. **/ public function element_items() { $this->items = array( //Create fields shown in the Content tab. Use 'notab' to use a single tab. 'content' => array( //create a textfield for the title array( 'name' => __('Title', IGPBL ), 'id' => 'main_title', 'type' => 'text_field', 'role' => 'title', 'class' => 'jsn-input-xxlarge-fluid', 'std' => __('Hello World', IGPBL), 'tooltip' => __('Set the title of this element', IGPBL) ), //subelement array( 'id' => 'funfacts_items', 'type' => 'group', 'shortcode' => ucfirst( __CLASS__ ), 'sub_item_type' => $this->config['has_subshortcode'], 'sub_items' => array( array( 'std' => '' ), array( 'std' => '' ), ), ), /** * Besides the tiny_mce and text_field you can choose from : * - button * - button_group * - checkbox * - color_picker * - dimension (w|h) * - gradient_picker * - group * - hidden * - hr * - icons * - items_list * - margin * - preview * - radio_button_group * - radio * - select_media * - select * - slider * - text_area * - text_number */ ), 'styling' => array( array( 'name' => __('Style', IGPBL), 'id' => 'style', 'type' => 'select', 'std' => 'alert-success', 'options' => array( 'alert-danger' => __('Red'), 'alert-success' => __('green'), 'alert-warning' => __('Blue'), ), ), ) ); } }
The code for the child elements
class IG_Item_funfacts extends IG_Pb_Shortcode_Child { public function __construct() { parent::__construct(); } public function element_config() { $this->config['shortcode'] = strtolower(__CLASS__); $this->config['exception'] = array( 'data-modal-title' => __( 'Funfact Item', IGPBL ) ); } public function element_items() { $this->items = array( 'Notab' => array( array( 'name' => __('Title', IGPBL ), 'id' => 'title', 'type' => 'text_field', 'role' => 'title', 'class' => 'jsn-input-xxlarge-fluid', 'std' => __( IG_Pb_Utils_Placeholder::add_placeholder( 'Accordion Item %s', 'index' ), IGPBL ), 'tooltip' => __('Set the title of this element', IGPBL) ), //create a WYSIWIG editor for content. array( 'name' => __('Content', IGPBL ), 'id' => 'type', 'type' => 'text_field', 'class' => 'jsn-input-xx-large-fluid', 'tooltip' => __('Set the content of this element', IGPBL) ), ) ); } }
Can anybody help me?
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Custom addon for child elements is not displaying correctly’ is closed to new replies.