public static function i(array $data = []) { $obj = new static(); $obj->addClass('chartPanel'); $obj->setData($data); $obj->_processData(); return $obj; }
public static function make($content, $header = null, $footer = null) { $tag = new static(); $tag->_header = $header; $tag->_footer = $footer; $tag->setContents($content); $tag->addClass('panel panel-default'); return $tag; }
/** * Dynamically create labels */ public static function __callStatic($method, $parameters) { // Get Label type if ($method == 'normal') { $type = null; } else { $type = static::$baseClass . '-' . (string) $method; } // Get content and attributes $content = isset($parameters[0]) ? $parameters[0] : null; $attributes = isset($parameters[1]) ? $parameters[1] : array(); $element = new static(static::$defaultElement, $content, $attributes); $element->addClass(static::$baseClass . ' ' . $type); return $element; }
/** * Allows magic methods such as Icon::home([attributes]) or Icon::close_white() * * Sample Usage: * <code> * <?php * Icon::plus(); * // <i class="icon-plus"></i> * Icon::folder_open(array('class'=>'widget','data-foo'=>'bar')); * // <i class="widget icon-folder-open" data-foo="bar"></i> * Icon::circle_arrow_right_white(); * // <i class="icon-circle-arrow-right icon-white"></i> * ?> * </code> * * @param string $method Name of missing method * @param array $parameters array of parameters passed to missing method * * @return string */ public static function __callStatic($method, $parameters) { // Explode method name $classes = explode('_', strtolower($method)); $white = in_array('white', $classes); if ($white) { unset($classes[array_search('white', $classes)]); } // Concatenate icons $classes = Helpers::getContainer('config')->get('bootstrapper::icons_prefix') . implode('-', $classes); if ($white) { $classes .= ' ' . Helpers::getContainer('config')->get('bootstrapper::icons_prefix') . 'white'; } $attributes = isset($parameters[0]) ? $parameters[0] : $parameters; $icon = new static($attributes); $icon->addClass($classes); return $icon; }
/** * Create a new Alert. * * @param string $type Type of alert * @param string $message Message in alert * @param bool $enable_close Is Alert closable * @param array $attributes Parent div attributes * * @return string Alert HTML */ protected static function show($type, $message, $attributes = array()) { $instance = new static('div', null, $attributes); // Save given parameters $instance->addClass($type); $instance->message = $message; return $instance; }