"styleBlock", 'order' => 30); class styleBlock extends block { protected $blockname = "style"; protected $fields = array( 'mbs-style' => array('default' => 'square'), // shapes of button, sets a bunch of css 'mbs-width' => array('default' => '55px', 'css' => 'width', 'csspart' => 'mb-social'), 'mbs-height' => array('default' => '55px', 'css' => 'height', 'csspart' => 'mb-social'), // 'icon_size' => array('default' => 0), /* 'font_size' => array('default' => '15px', 'css' => 'font-size', 'csspart' => 'mb-label'), */ //'count_font_size' => array('default' => '15px'), //'share_font_size' => array('default' => '15px'), ); public $add_preview_style = false; // public $preview_style = false; public function set($data) { parent::set($data); $blockdata = $this->data[$this->blockname]; if (isset($blockdata['mbs-style']) && ! empty($blockdata['mbs-style']) ) { $styleObj = styles::getStyle($blockdata['mbs-style']); if ($styleObj) $this->collection->setStyle( $styleObj ); } else // default to first style - default option { //$styles = styles::getStyles(); $def_style = $this->fields['mbs-style']['default']; $style = styles::getStyle($def_style); $this->collection->setStyle($style); /*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) { $label = $this->network->get_label(); if ($label) { $anchor = $itemObj->find('.mb-social', 0); if (is_object($anchor)) { $anchor->class .= ' '; $label_text = '' . $label . ''; $anchor->innertext .= $label_text; // $itemObj->load($itemObj->save() ); $this->collection->getStyle()->addDisplay('label'); } } } 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'); $admin = MBSocial()->admin(); $blockdata = isset($this->data[$this->blockname]) ? $this->data[$this->blockname] : array(); $data_style = isset($blockdata['mbs-style']) ? $blockdata['mbs-style'] : false; // $icon_url = MBSocial()->get_plugin_url() . 'images/icons/'; $icons = array( 'shape_round' => 'shape_circle.png', 'shape_square' => 'shape_square.png', // 'shape_stretch' => 'shape_stretch.png', ); ?>
Use the Presets to set multiple style options at once. This will overwrite some current settings : Shape, Width and the items under Customization. It will not change your network selections. Once you have selected a preset you can use Shape, Width and Height to customize it.
Shapes - Choose between circle and rectangle.