/** * Editor Element */ function editor_element($params) { extract($params); $name = $this->config['shortcode']; $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = $this->config['name']; $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); $output = "<div class='avia_layout_section avia_pop_class avia-no-visual-updates " . $name . " av_drag' " . $dataString . ">"; $output .= " <div class='avia_sorthandle menu-item-handle'>"; $output .= " <span class='avia-element-title'>" . $this->config['name'] . "</span>"; $output .= " <a class='avia-delete' href='#delete' title='" . __('Delete Section', 'avia_framework') . "'>x</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Section', 'avia_framework') . "'>edit</a>"; } $output .= " <a class='avia-clone' href='#clone' title='" . __('Clone Section', 'avia_framework') . "' >" . __('Clone Section', 'avia_framework') . "</a></div>"; $output .= " <div class='avia_inner_shortcode avia_connect_sort av_drop' data-dragdrop-level='" . $this->config['drop-level'] . "'>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($name, $content, $args) . "</textarea>"; if ($content) { $content = $this->builder->do_shortcode_backend($content); } $output .= $content; $output .= "</div></div>"; return $output; }
/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { extract($params); $name = $this->config['shortcode']; $drag = $this->config['drag-level']; $drop = $this->config['drop-level']; $size = array('av_one_full' => '1/1', 'av_one_half' => '1/2', 'av_one_third' => '1/3', 'av_one_fourth' => '1/4', 'av_one_fifth' => '1/5', 'av_two_third' => '2/3', 'av_three_fourth' => '3/4', 'av_two_fifth' => '2/5', 'av_three_fifth' => '3/5', 'av_four_fifth' => '4/5'); $extraClass = isset($args[0]) ? $args[0] == 'first' ? ' avia-first-col' : "" : ""; $output = "<div class='avia_layout_column avia_pop_class " . $name . $extraClass . " av_drag' data-dragdrop-level='{$drag}' data-width='{$name}'>"; $output .= "<div class='avia_sorthandle menu-item-handle'>"; $output .= "<a class='avia-smaller avia-change-col-size' href='#smaller' title='" . __('Decrease Column Size', 'avia_framework') . "'>-</a>"; $output .= "<span class='avia-col-size'>" . $size[$name] . "</span>"; $output .= "<a class='avia-bigger avia-change-col-size' href='#bigger' title='" . __('Increase Column Size', 'avia_framework') . "'>+</a>"; $output .= "<a class='avia-delete' href='#delete' title='" . __('Delete Column', 'avia_framework') . "'>x</a>"; //$output .= "<a class='avia-new-target' href='#new-target' title='".__('Move Element','avia_framework' )."'>+</a>"; $output .= "<a class='avia-clone' href='#clone' title='" . __('Clone Column', 'avia_framework') . "' >" . __('Clone Column', 'avia_framework') . "</a></div>"; $output .= "<div class='avia_inner_shortcode avia_connect_sort av_drop ' data-dragdrop-level='{$drop}'>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($name, $content, $args) . "</textarea>"; if ($content) { $content = $this->builder->do_shortcode_backend($content); } $output .= $content; $output .= "</div></div>"; return $output; }
/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { extract($params); $name = $this->config['shortcode']; $drag = $this->config['drag-level']; $drop = $this->config['drop-level']; $size = array('av_cell_one_full' => '1/1', 'av_cell_one_half' => '1/2', 'av_cell_one_third' => '1/3', 'av_cell_one_fourth' => '1/4', 'av_cell_one_fifth' => '1/5', 'av_cell_two_third' => '2/3', 'av_cell_three_fourth' => '3/4', 'av_cell_two_fifth' => '2/5', 'av_cell_three_fifth' => '3/5', 'av_cell_four_fifth' => '4/5'); $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = __('Edit Cell', 'avia_framework'); $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); $output = "<div class='avia_layout_column avia_layout_cell avia_pop_class avia-no-visual-updates " . $name . " av_drag' {$dataString} data-width='{$name}'>"; $output .= "<div class='avia_sorthandle'>"; $output .= "<span class='avia-col-size'>" . $size[$name] . "</span>"; $output .= "<a class='avia-delete' href='#delete' title='" . __('Delete Cell', 'avia_framework') . "'>x</a>"; $output .= "<a class='avia-clone' href='#clone' title='" . __('Clone Cell', 'avia_framework') . "' >" . __('Clone Cell', 'avia_framework') . "</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Cell', 'avia_framework') . "'>edit</a>"; } $output .= "</div><div class='avia_inner_shortcode avia_connect_sort av_drop ' data-dragdrop-level='{$drop}'><span class='av-fake-cellborder'></span>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($name, $content, $args) . "</textarea>"; if ($content) { $content = $this->builder->do_shortcode_backend($content); } $output .= $content; $output .= "</div></div>"; return $output; }
/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { /* $params['content'] = trim($params['content']); if(empty($params['content'])) $params['content'] = "[av_cell_one_half first][/av_cell_one_half] [av_cell_one_half][/av_cell_one_half]"; */ extract($params); $name = $this->config['shortcode']; $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = $this->config['name']; $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); if ($content) { $final_content = $this->builder->do_shortcode_backend($content); $text_area = ShortcodeHelper::create_shortcode_by_array($name, $content, $args); } else { $cell = new avia_sc_cell_one_half($this->builder); $params = array('content' => "", 'args' => array(), 'data' => ''); $final_content = ""; $final_content .= $cell->editor_element($params); $final_content .= $cell->editor_element($params); $text_area = ShortcodeHelper::create_shortcode_by_array($name, '[av_cell_one_half first][/av_cell_one_half] [av_cell_one_half][/av_cell_one_half]', $args); } $output = "<div class='avia_layout_row avia_layout_section avia_pop_class avia-no-visual-updates " . $name . " av_drag' " . $dataString . ">"; $output .= " <a class='avia-add-cell avia-add' href='#add-cell' title='" . __('Add Cell', 'avia_framework') . "'>Add Cell</a>"; $output .= " <a class='avia-set-cell-size avia-add' href='#set-size' title='" . __('Set Cell Size', 'avia_framework') . "'>Set Cell Size</a>"; $output .= " <div class='avia_sorthandle menu-item-handle'>"; $output .= " <span class='avia-element-title'>" . $this->config['name'] . "</span>"; $output .= " <a class='avia-delete' href='#delete' title='" . __('Delete Row', 'avia_framework') . "'>x</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Row', 'avia_framework') . "'>edit</a>"; } $output .= "<a class='avia-save-element' href='#save-element' title='" . __('Save Element as Template', 'avia_framework') . "'>+</a>"; $output .= " <a class='avia-clone' href='#clone' title='" . __('Clone Row', 'avia_framework') . "' >" . __('Clone Row', 'avia_framework') . "</a></div>"; $output .= " <div class='avia_inner_shortcode avia_connect_sort av_drop' data-dragdrop-level='" . $this->config['drop-level'] . "'>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . $text_area . "</textarea>"; $output .= $final_content; $output .= "</div></div>"; return $output; }
/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { extract($params); $name = $this->config['shortcode']; $drag = $this->config['drag-level']; $drop = $this->config['drop-level']; $size = array('av_one_full' => '1/1', 'av_one_half' => '1/2', 'av_one_third' => '1/3', 'av_one_fourth' => '1/4', 'av_one_fifth' => '1/5', 'av_two_third' => '2/3', 'av_three_fourth' => '3/4', 'av_two_fifth' => '2/5', 'av_three_fifth' => '3/5', 'av_four_fifth' => '4/5'); $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = __('Edit Column', 'avia_framework'); $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); $extraClass = isset($args[0]) ? $args[0] == 'first' ? ' avia-first-col' : "" : ""; $output = "<div class='avia_layout_column avia_layout_column_no_cell avia_pop_class avia-no-visual-updates " . $name . $extraClass . " av_drag' {$dataString} data-width='{$name}'>"; $output .= "<div class='avia_sorthandle menu-item-handle'>"; $output .= "<a class='avia-smaller avia-change-col-size' href='#smaller' title='" . __('Decrease Column Size', 'avia_framework') . "'>-</a>"; $output .= "<span class='avia-col-size'>" . $size[$name] . "</span>"; $output .= "<a class='avia-bigger avia-change-col-size' href='#bigger' title='" . __('Increase Column Size', 'avia_framework') . "'>+</a>"; $output .= "<a class='avia-delete' href='#delete' title='" . __('Delete Column', 'avia_framework') . "'>x</a>"; $output .= "<a class='avia-save-element' href='#save-element' title='" . __('Save Element as Template', 'avia_framework') . "'>+</a>"; //$output .= "<a class='avia-new-target' href='#new-target' title='".__('Move Element','avia_framework' )."'>+</a>"; $output .= "<a class='avia-clone' href='#clone' title='" . __('Clone Column', 'avia_framework') . "' >" . __('Clone Column', 'avia_framework') . "</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Cell', 'avia_framework') . "'>edit</a>"; } $output .= "</div>"; $output .= "<div class='avia_inner_shortcode avia_connect_sort av_drop ' data-dragdrop-level='{$drop}'>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($name, $content, $args) . "</textarea>"; if ($content) { $content = $this->builder->do_shortcode_backend($content); } $output .= $content; $output .= "</div></div>"; return $output; }
/** * helper function that gets the default value of the content element * * @param array $elements * @return array $args */ public function get_default_content($content = "") { if (!empty($this->elements)) { //if we didnt iterate over the arguments array yet do it now if (empty($this->default_args)) { $this->get_default_args(); } //if there is a content element already thats the value. if not try to fetch the std value if (!isset($this->default_args['content'])) { foreach ($this->elements as $element) { if (isset($element['std']) && isset($element['id']) && $element['id'] == "content") { $content = $element['std']; } } } else { $content = $this->default_args['content']; } } //if the content is an array we got a nested shortcode if (is_array($content)) { $string_content = ""; foreach ($content as $c) { $string_content .= trim(ShortcodeHelper::create_shortcode_by_array($this->config['shortcode_nested'][0], NULL, $c)) . "\n"; } $content = $string_content; } return $content; }
function modal_group_sub($element, $parent_class, $i = false) { $output = ""; $args = array(); $content = NULL; //iterate over the subelements and set the default values foreach ($element['subelements'] as $key => $subelement) { if (isset($element['std']) && is_array($element['std']) && isset($element['std'][$i][$subelement['id']])) { $subelement['std'] = $element['std'][$i][$subelement['id']]; } //if $i is not set, meaning we need a totaly empty template reset the std values if ($i === false) { $subelement['std'] = ""; } if ($subelement['id'] == 'content') { $content = $subelement['std']; } else { $args[$subelement['id']] = $subelement['std']; } } $params['args'] = $args; $params['content'] = $content; $defaults = array('class' => '', 'innerHtml' => ''); $params = array_merge($defaults, $params); $params = $parent_class->editor_sub_element($params); extract($params); $data['modal_title'] = $element['modal_title']; $data['shortcodehandler'] = $parent_class->config['shortcode_nested'][0]; $data['modal_ajax_hook'] = $parent_class->config['shortcode_nested'][0]; $data['modal_on_load'] = array(); if (!empty($element['modal_on_load'])) { $data['modal_on_load'] = array_merge($data['modal_on_load'], $element['modal_on_load']); } if (!empty($parent_class->config['modal_on_load'])) { $data['modal_on_load'] = array_merge($data['modal_on_load'], $parent_class->config['modal_on_load']); } $dataString = AviaHelper::create_data_string($data); $output .= "<div class='avia-modal-group-element ' {$dataString}>"; $output .= "<a class='avia-attach-modal-element-move avia-move-handle'>" . __('Move', 'avia_framework') . "</a>"; $output .= "<a class='avia-attach-modal-element-delete avia-delete'>" . __('Delete', 'avia_framework') . "</a>"; $output .= "<div class='avia-modal-group-element-inner'>"; $output .= $params['innerHtml']; $output .= "</div>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4' name='{$element['id']}'>" . ShortcodeHelper::create_shortcode_by_array($parent_class->config['shortcode_nested'][0], $content, $args) . "</textarea>"; $output .= "</div>"; return $output; }