/** * 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) { //fetch all registered sidebars $sidebars = AviaHelper::get_registered_sidebars(); if (empty($params['args']['widget_area'])) { $params['args']['widget_area'] = reset($sidebars); } $element = array('subtype' => $sidebars, 'type' => 'select', 'std' => htmlspecialchars_decode($params['args']['widget_area']), 'class' => 'avia-recalc-shortcode', 'data' => array('attr' => 'widget_area')); $inner = "<img src='" . $this->config['icon'] . "' title='" . $this->config['name'] . "' />"; $inner .= "<div class='avia-element-label'>" . $this->config['name'] . "</div>"; $inner .= AviaHtmlHelper::render_element($element); $params['class'] = ""; $params['content'] = NULL; $params['innerHtml'] = $inner; return $params; }
/** * 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) { //fetch all registered slides and save them to the slides array $slides = avia_find_layersliders(true); if (empty($params['args']['id']) && is_array($slides)) { $params['args']['id'] = reset($slides); } $element = array('subtype' => $slides, 'type' => 'select', 'std' => $params['args']['id'], 'class' => 'avia-recalc-shortcode', 'data' => array('attr' => 'id')); $inner = "<img src='" . $this->config['icon'] . "' title='" . $this->config['name'] . "' />"; if (empty($slides)) { $inner .= "<div><a target='_blank' href='" . admin_url('admin.php?page=layerslider') . "'>" . __('No Layer Slider Found. Click here to create one', 'avia_framework') . "</a></div>"; } else { $inner .= "<div class='avia-element-label'>" . $this->config['name'] . "</div>"; $inner .= AviaHtmlHelper::render_element($element); $inner .= "<a target='_blank' href='" . admin_url('admin.php?page=layerslider') . "'>" . __('Edit Layer Slider here', 'avia_framework') . "</a>"; } $params['class'] = "av_sidebar"; $params['content'] = NULL; $params['innerHtml'] = $inner; return $params; }