/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Heading', 'plumtree'), 'id' => 'heading', 'type' => 'text_field', 'class' => 'jsn-input-xxlarge-fluid', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Testimonials Item %s', 'index'), 'plumtree'), 'tooltip' => __('Set the text of your heading items', 'plumtree')), array('name' => __('Image File', 'plumtree'), 'id' => 'image_file', 'type' => 'select_media', 'std' => '', 'class' => 'jsn-input-large-fluid', 'tooltip' => __('Select background image for item', 'plumtree')), array('name' => __('Body', 'plumtree'), 'id' => 'body', 'role' => 'content', 'type' => 'editor', 'std' => IG_Pb_Helper_Type::lorem_text(), 'tooltip' => __('Set content of element', 'plumtree')), array('name' => __('Signature', 'plumtree'), 'id' => 'sign', 'type' => 'text_field', 'class' => 'jsn-input-xxlarge-fluid', 'role' => 'title', 'std' => '', 'tooltip' => __('Set the text items', 'plumtree')))); }
/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Heading', IGPBL), 'id' => 'heading', 'type' => 'text_field', 'class' => 'input-sm', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Accordion Item %s', 'index'), IGPBL), 'tooltip' => __('Set heading text of item', IGPBL)), array('name' => __('Body', IGPBL), 'id' => 'body', 'role' => 'content', 'type' => 'editor', 'std' => IG_Pb_Helper_Type::lorem_text(), 'tooltip' => __('Set content of element', IGPBL)), array('name' => __('Icon', IGPBL), 'id' => 'icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', IGPBL)), array('name' => __('Tag', IGPBL), 'id' => 'tag', 'type' => 'tag', 'std' => '', 'tooltip' => __('Organize your content and group items by tags', IGPBL)))); }
/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Title', IGPBL), 'id' => 'title', 'type' => 'text_field', 'class' => 'input-sm', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Button %s', 'index'), IGPBL), 'tooltip' => __('Set text for tooltip on hover', IGPBL)), array('name' => __('URL for button', IGPBL), 'id' => 'url', 'type' => 'text_field', 'role' => 'url', 'class' => 'input-sm', 'std' => __('http://', IGPBL), 'tooltip' => __('Enter an url', IGPBL)), array('name' => __('Icon for button', IGPBL), 'id' => 'icon', 'type' => 'text_field', 'role' => 'icon', 'class' => 'input-sm', 'std' => __('Example: facebook, twitter, gplus', IGPBL), 'tooltip' => __('Enter name of icon according to FontAwesome icons', IGPBL)))); }
/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Heading', 'plumtree'), 'id' => 'heading', 'type' => 'text_field', 'class' => 'jsn-input-xxlarge-fluid', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Carousel Item %s', 'index'), 'plumtree'), 'tooltip' => __('Set the text of your heading items', 'plumtree')), array('name' => __('Body', 'plumtree'), 'id' => 'body', 'role' => 'content', 'type' => 'editor', 'std' => IG_Pb_Helper_Type::lorem_text(), 'tooltip' => __('Set content of element', 'plumtree')), array('name' => __('Icon', 'plumtree'), 'id' => 'icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', 'plumtree')))); }
/** * DEFINE html structure of shortcode in Page Builder area * * @param string $content * @param string $shortcode_data: string stores params (which is modified default value) of shortcode * @param string $el_title: Element Title used to identifying elements in IG PageBuilder * @param int $index * @param bool $inlude_sc_structure * @param array $extra_params * Ex: param-tag=h6¶m-text=Your+heading¶m-font=custom¶m-font-family=arial * @return string */ public function element_in_pgbldr($content = '', $shortcode_data = '', $el_title = '', $index = '', $inlude_sc_structure = true, $extra_params = array()) { // Init neccessary data to render element in backend. $this->init_element(); $shortcode = $this->config['shortcode']; $is_sub_element = isset($this->config['sub_element']) ? true : false; $parent_shortcode = $is_sub_element ? str_replace('ig_item_', '', $shortcode) : $shortcode; $type = !empty($this->config['el_type']) ? $this->config['el_type'] : 'widget'; // Empty content if this is not sub element if (!$is_sub_element) { $content = ''; } $exception = isset($this->config['exception']) ? $this->config['exception'] : array(); $content = isset($exception['default_content']) ? $exception['default_content'] : $content; $modal_title = ''; // if is widget if ($type == 'widget') { global $Ig_Pb_Widgets; if (isset($Ig_Pb_Widgets[$shortcode]) && is_array($Ig_Pb_Widgets[$shortcode]) && isset($Ig_Pb_Widgets[$shortcode]['identity_name'])) { $modal_title = $Ig_Pb_Widgets[$shortcode]['identity_name']; $content = $this->config['exception']['data-modal-title'] = $modal_title; } } // if content is still empty, Generate it if (empty($content)) { if (!$is_sub_element) { $content = ucfirst(str_replace('ig_', '', $shortcode)); } else { if (isset($exception['item_text'])) { if (!empty($exception['item_text'])) { $content = IG_Pb_Utils_Placeholder::add_placeholder($exception['item_text'] . ' %s', 'index'); } } else { $content = IG_Pb_Utils_Placeholder::add_placeholder(__(ucfirst($parent_shortcode), IGPBL) . ' ' . __('Item', IGPBL) . ' %s', 'index'); } } } $content = !empty($el_title) ? $content . ': ' . "<span>{$el_title}</span>" : $content; // element name if ($type == 'element') { if (!$is_sub_element) { $name = ucfirst(str_replace('ig_', '', $shortcode)); } else { $name = __(ucfirst($parent_shortcode), IGPBL) . ' ' . __('Item', IGPBL); } } else { $name = $content; } if (empty($shortcode_data)) { $shortcode_data = $this->config['shortcode_structure']; } // Process index for subitem element if (!empty($index)) { $shortcode_data = str_replace('_IG_INDEX_', $index, $shortcode_data); } $shortcode_data = stripslashes($shortcode_data); $element_wrapper = !empty($exception['item_wrapper']) ? $exception['item_wrapper'] : ($is_sub_element ? 'li' : 'div'); $content_class = $is_sub_element ? 'jsn-item-content' : 'ig-pb-element'; $modal_title = empty($modal_title) ? !empty($exception['data-modal-title']) ? "data-modal-title='{$exception['data-modal-title']}'" : '' : $modal_title; $element_type = "data-el-type='{$type}'"; $edit_using_ajax = !empty($exception['edit_using_ajax']) ? sprintf("data-using-ajax='%s'", esc_attr($exception['edit_using_ajax'])) : ''; $data = array('element_wrapper' => $element_wrapper, 'modal_title' => $modal_title, 'element_type' => $element_type, 'edit_using_ajax' => $edit_using_ajax, 'name' => $name, 'shortcode' => $shortcode, 'shortcode_data' => $shortcode_data, 'content_class' => $content_class, 'content' => $content, 'action_btn' => empty($exception['action_btn']) ? '' : $exception['action_btn']); // Merge extra params if it exists. if (!empty($extra_params)) { $data = array_merge($data, $extra_params); } $extra = array(); if (isset($this->config['exception']['disable_preview_container'])) { $extra = array('has_preview' => FALSE); } $data = array_merge($data, $extra); $html_preview = IG_Pb_Helper_Functions::get_element_item_html($data, $inlude_sc_structure); return array($html_preview); }
/** * Define shortcode settings. * * @return void */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Text', IGPBL), 'id' => 'button_text', 'type' => 'text_field', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('ButtonBar Item %s', 'index'), IGPBL), 'role' => 'title', 'tooltip' => __('Set the text on the button', IGPBL)), array('name' => __('On Click', IGPBL), 'id' => 'link_type', 'type' => 'select', 'class' => 'input-sm', 'std' => 'url', 'options' => IG_Pb_Helper_Type::get_link_types(), 'has_depend' => '1', 'tooltip' => __('Select link types: link to post, page, category...', IGPBL)), array('name' => __('URL', IGPBL), 'id' => 'button_type_url', 'type' => 'text_field', 'class' => 'input-sm', 'std' => 'http://', 'dependency' => array('link_type', '=', 'url'), 'tooltip' => __('Set url of button', IGPBL)), array('name' => __('Single Item', IGPBL), 'id' => 'single_item', 'type' => 'type_group', 'std' => '', 'items' => IG_Pb_Helper_Type::get_single_item_button_bar('link_type', array('type' => 'items_list', 'options_type' => 'select', 'class' => 'select2-select', 'ul_wrap' => false)), 'tooltip' => __('Choose item to link to', IGPBL)), array('name' => __('Open in', IGPBL), 'id' => 'open_in', 'type' => 'select', 'class' => 'input-sm', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_open_in_options()), 'options' => IG_Pb_Helper_Type::get_open_in_options(), 'dependency' => array('link_type', '!=', 'no_link'), 'tooltip' => __('Select type of opening action when click on element', IGPBL)), array('name' => __('Icon', IGPBL), 'id' => 'icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', IGPBL)), array('name' => __('Size', IGPBL), 'id' => 'button_size', 'type' => 'select', 'class' => 'input-sm', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_button_size()), 'options' => IG_Pb_Helper_Type::get_button_size(), 'tooltip' => __('Set the size of the button', IGPBL)), array('name' => __('Color', IGPBL), 'id' => 'button_color', 'type' => 'select', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_button_color()), 'options' => IG_Pb_Helper_Type::get_button_color(), 'container_class' => 'color_select2', 'tooltip' => __('Select the color of the button', IGPBL)))); }
public function element_items() { $this->items = array('Notab' => array(array('name' => __('Text', IGPBL), 'id' => 'pbar_text', 'type' => 'text_field', 'class' => 'input-sm', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Progress Bar Item %s', 'index'), IGPBL), 'role' => 'title', 'tooltip' => __('Text', IGPBL)), array('name' => __('Percentage', IGPBL), 'id' => 'pbar_percentage', 'type' => 'text_append', 'input_type' => 'number', 'class' => 'input-mini', 'std' => '25', 'append' => '%', 'validate' => 'number', 'parent_class' => 'combo-item', 'tooltip' => __('Percentage', IGPBL)), array('name' => __('Color', IGPBL), 'id' => 'pbar_color', 'type' => 'select', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_progress_bar_color()), 'options' => IG_Pb_Helper_Type::get_progress_bar_color(), 'tooltip' => __('Color', IGPBL), 'container_class' => 'color_select2'), array('name' => __('Style', IGPBL), 'id' => 'pbar_item_style', 'type' => 'select', 'class' => 'input-sm', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_progress_bar_item_style()), 'options' => IG_Pb_Helper_Type::get_progress_bar_item_style(), 'tooltip' => __('Style', IGPBL)), array('name' => __('Icon', IGPBL), 'id' => 'pbar_icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', IGPBL)), array('id' => 'pbar_group', 'class' => 'pbar_group_type', 'type' => 'hidden', 'std' => 'multiple-bars'))); }
/** * print HTML template of shortcodes */ function element_tpl() { ob_start(); // Print template for IG PageBuilder elements $elements = $this->get_elements(); foreach ($elements as $type_list) { foreach ($type_list as $element) { // Get element type $element_type = $element->element_in_pgbldr(null, null, null, null, false); // Print template tag foreach ($element_type as $element_structure) { echo balanceTags("<script type='text/html' id='tmpl-{$element->config['shortcode']}'>\n{$element_structure}\n</script>\n"); } } } // Print widget template global $Ig_Pb_Widgets; if (class_exists('IG_Widget')) { foreach ($Ig_Pb_Widgets as $shortcode => $shortcode_obj) { // Instantiate Widget element $element = new IG_Widget(); // Prepare necessary variables $modal_title = $shortcode_obj['identity_name']; $content = $element->config['exception']['data-modal-title'] = $modal_title; $element->config['shortcode'] = $shortcode; $element->config['shortcode_structure'] = IG_Pb_Utils_Placeholder::add_placeholder("[ig_widget widget_id=\"{$shortcode}\"]%s[/ig_widget]", 'widget_title'); $element->config['el_type'] = $type; // Get element type $element_type = $element->element_in_pgbldr(null, null, null, null, false); // Print template tag foreach ($element_type as $element_structure) { echo balanceTags("<script type='text/html' id='tmpl-{$shortcode}'>\n{$element_structure}\n</script>\n"); } } } // Allow printing extra footer do_action('ig_pb_footer'); ob_end_flush(); }