"styleBlock", 'order' => 30); class styleBlock extends block { protected $blockname = "style"; protected $fields = array( "style" => array("default" => "0" ), 'custom_list' => array('default' => array() ), ); public $add_preview_style = false; // public $preview_style = false; public function set($data) { parent::set($data); $blockdata = $this->data[$this->blockname]; if (isset($blockdata['style']) && ! empty($blockdata['style']) ) { $styleObj = styles::getStyle($blockdata['style']); if ($styleObj) $this->collection->setStyle( $styleObj ); } else // default to first style - default option { $styles = styles::getStyles(); if (count($styles) > 0) { $first_ar = array_shift($styles); $style_obj = array_shift($first_ar); $data_style = $style_obj->name; $style = styles::getStyle($data_style); $this->collection->setStyle($style); } } } public function parse($itemObj, $args = array() ) { $block_data = isset($this->data[$this->blockname]) ? $this->data[$this->blockname] : array(); $style = $this->collection->getStyle(); if ($style->has_label) { $network = $args['network']; $anchor = $itemObj->find('.maxbutton-social', 0); $label = $network->get('label'); if ($label) { $anchor->class .= ' with-label '; $label_text = '' . $label . ''; $anchor->innertext .= $label_text; $itemObj->load($itemObj->save() ); } } if ($args['preview'] == true && $this->add_preview_style) { $style = $this->add_preview_style; } return $itemObj; } public function ajax_get_all_styles() { $available_styles = styles::getStyles(); } public function admin() { wp_enqueue_style('mbsocial-buttons'); $active_networks = isset($this->data['network']['active']) ? $this->data['network']['active'] : array(); $admin = mbSocial()->admin(); $networks = mbSocial()->networks()->get(); $networks = $admin->get_networks($active_networks); if (count($networks['selected']) == 0) $networks = $networks['unselected']; else $networks = $networks['selected']; $blockdata = isset($this->data[$this->blockname]) ? $this->data[$this->blockname] : array(); $data_style = isset($blockdata['style']) ? $blockdata['style'] : false; // ?>
true, 'load_type' => 'inline', 'echo' => true, 'compile' => true, ); foreach($styles as $order => $style_classes) { foreach($style_classes as $style_class) { //echo $style_class->class . "

--"; //$styleBlock = $collection->getBlock('styleBlock'); $this->add_preview_style = $style_class->class; $this->collection->setStyle($style_class); $this->collection->display($args); // echo "--

"; } } */ ?> name ) ? ' checked ' : ''; $args = array('preview' => true, 'load_type' => 'inline', 'compile' => true, ); ?>
collection->getStyle(); // set by the set data set of this block $style_name = $style->class; ?>
preview_style = $style->class; $this->collection->display($args); ?>