create_element_structure(); $this->extra_config( $am_elements ); $this->precreate_visual_editor(); } // reload the class again using given config array public function reload( $config ) { if(count($config)>0) { $this->config = $config; $this->precreate_visual_editor(); if(isset($this->config['popup_editor']) && $this->config['popup_editor']) { $this->parse_editor_elements(); } } } // the main method that will create the element structure, it has to be implemented in the element class. abstract function create_element_structure(); /** * Return configuratino array */ public function element_to_array() { return $this->config; } /** * additional config vars that are set automatically */ protected function extra_config( $am_elements = array() ) { $this->config['childrenId'] = array(); //if the element class contain method "popup_elements" it will be called. // if it's not then the element is not editable, i.e. no popup will be displayed when element is clicked. if( method_exists($this, 'popup_elements') ) { $this->popup_elements( $am_elements ); if( !empty($this->config['subElements']) ) { $this->config['popup_editor'] = true; //$this->parse_editor_elements(); } } } /** * Prepare the editable popup content by reading all elements subElemenet and add it to attribute "editPanel_innerHtml". */ private function parse_editor_elements() { $output = ""; $output .= "
"; $this->config['editPanel_innerHtml'] = $output; } /** * Check the subelement type and render it with the correct implementation * @param $element element * @return string correct implementation for the element according to its type */ private function parseElementType( $element ) { $output = ""; switch ($element['type']) { case ElementTypeEnum::COLOR: $output .= ''; break; case ElementTypeEnum::GALLERY: $output .= ''.__('Attach Images to Gallery', 'fusion-core').''; break; case ElementTypeEnum::UPLOAD: $button_class = ( $element['value'] == 'fusion-hidden-img' ? '' : 'remove-image' ); $button_text = ( $element['value'] == 'fusion-hidden-img' ? __('Upload', 'fusion-core') : __('Remove', 'fusion-core') ); $output .= '