| 1 |
<?php |
| 2 |
namespace MaxButtons; |
| 3 |
defined('ABSPATH') or die('No direct access permitted'); |
| 4 |
$blockClass["dimension"] = "dimensionBlock"; |
| 5 |
$blockOrder[20][] = "dimension"; |
| 6 |
|
| 7 |
class dimensionBlock extends maxBlock |
| 8 |
{ |
| 9 |
protected $blockname = "dimension"; |
| 10 |
protected $fields = array("button_width" => array("default" => '160px', |
| 11 |
"css" => "width", |
| 12 |
), |
| 13 |
"button_height" => array("default" => '50px', |
| 14 |
"css" => "height") |
| 15 |
); |
| 16 |
|
| 17 |
public function parse_css($css, $mode = 'normal') |
| 18 |
{ |
| 19 |
$css = parent::parse_css($css, $mode); |
| 20 |
|
| 21 |
if (! isset($css["maxbutton"]["normal"]["width"])) return $css; |
| 22 |
|
| 23 |
// do not allow zero's. |
| 24 |
if (isset($css["maxbutton"]["normal"]["width"]) && ($css["maxbutton"]["normal"]["width"] == 0 || $css["maxbutton"]["normal"]["width"] == '') ) |
| 25 |
unset($css["maxbutton"]["normal"]["width"]); |
| 26 |
|
| 27 |
if (isset($css["maxbutton"]["normal"]["height"]) && ($css["maxbutton"]["normal"]["height"] == 0 || $css["maxbutton"]["normal"]["height"] == '') ) |
| 28 |
unset($css["maxbutton"]["normal"]["height"]); |
| 29 |
|
| 30 |
|
| 31 |
/* if ($css["normal"]["width"] > maxbuttons_strip_px(0) || $css["normal"]["height"] > maxbuttons_strip_px(0)) |
| 32 |
{ |
| 33 |
$css["normal"]["display"] = "inline-block"; |
| 34 |
} |
| 35 |
*/ |
| 36 |
|
| 37 |
return $css; |
| 38 |
} |
| 39 |
|
| 40 |
public function map_fields($map) |
| 41 |
{ |
| 42 |
$map = parent::map_fields($map); |
| 43 |
|
| 44 |
$map["button_width"]["func"] = "updateDimension"; |
| 45 |
$map["button_height"]["func"] = "updateDimension"; |
| 46 |
|
| 47 |
return $map; |
| 48 |
|
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
public function admin_fields() |
| 53 |
{ |
| 54 |
return; |
| 55 |
|
| 56 |
} // admin_fields |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
} // class |
| 61 |
|
| 62 |
?> |
| 63 |
|