本文整理汇总了PHP中Helpers::add_class方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::add_class方法的具体用法?PHP Helpers::add_class怎么用?PHP Helpers::add_class使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::add_class方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __callStatic
public static function __callStatic($method, $parameters)
{
$method = $method != 'normal' ? $method : 'default';
$parameters = $parameters ? $parameters : array(array());
$parameters = Helpers::add_class($parameters[0], 'panel panel-' . $method);
return new static($parameters);
}
示例2: make
private static function make($type, $contents = array(), $attributes = array())
{
$attributes = Helpers::add_class($attributes, 'buttons', 'data-toggle');
$attributes = Helpers::add_class($attributes, 'btn-group');
$string = "<div " . Helpers::getContainer('html')->attributes($attributes) . ">";
$string .= static::makeContents($contents, $type);
$string .= "</div>";
return $string;
}
示例3: __toString
public function __toString()
{
$name = $this->name;
$attributes = Helpers::add_class($this->attributes, 'panel-group');
$attributes = Helpers::add_class($attributes, $name, 'id');
$string = "<div" . Helpers::getContainer('html')->attributes($attributes) . ">";
$count = 1;
foreach ($this->contents as $content) {
$heading = $content[0];
$body = $content[1];
$panelAttributes = isset($content[2]) ? $content[2] : array();
$panelAttributes = Helpers::add_class($panelAttributes, 'panel panel-default');
$bodyAttributes = array(
'class' => 'panel-collapse collapse',
'id' => "$name-$count"
);
$bodyAttributes = $count == $this->opened ? Helpers::add_class($bodyAttributes, 'in') : $bodyAttributes;
$string .= "<div" . Helpers::getContainer('html')->attributes($panelAttributes) . ">";
$string .= "<div class='panel-heading'>";
$string .= "<h4 class='panel-title'>";
$string .= "<a class='accordion-toggle' data-toggle='collapse' data-parent='#$name' href='#$name-$count'>";
$string .= $heading;
$string .= "</a>";
$string .= "</h4>";
$string .= "</div>";
$string .= "<div" . Helpers::getContainer('html')->attributes($bodyAttributes) . ">";
$string .= "<div class='panel-body'>";
$string .= $body;
$string .= "</div>";
$string .= "</div>";
$string .= "</div>";
$count += 1;
}
$string .= "</div>";
return $string;
}
示例4: open
/**
* Opens a new ButtonToolbar section.
*
* @param array $attributes Attributes for the button toolbar
*
* @return string A button toolbar
*/
public static function open($attributes = array())
{
$attributes = Helpers::add_class($attributes, 'btn-toolbar');
return '<div' . Helpers::getContainer('html')->attributes($attributes) . '>';
}
示例5: __construct
/**
* Creates a new Carousel instance
*
* @param array $items The items to use as pictures
* @param array $attributes Its attributes
*/
public function __construct($items, $attributes = array())
{
$this->items = $items;
$this->attributes = Helpers::add_class($attributes, 'carousel slide');
// Set default active item
$this->active = key($items);
// Calculate the Carousel ID
$this->hash = '#' . array_get($attributes, 'id', 'carousel_' . Helpers::rand_string(5));
}
示例6: render
/**
* Outputs the current Dropdown in instance
*
* @return string A Dropdown menu
*/
public function render()
{
// Base class
$this->attributes = Helpers::add_class($this->attributes, 'btn-group');
// Pull right
$listAttributes = $this->pullRight ? array('class' => 'pull-right') : array();
// Dropup
if ($this->dropup) {
$this->attributes['class'] .= ' dropup';
}
$html = '<div' . Helpers::getContainer('html')->attributes($this->attributes) . '>';
//If split is false make this button dropdown
$html .= Form::button($this->label, array('class' => $this->type), !$this->split);
//Add split button if needed
if ($this->split) {
$html .= Form::button('', array('class' => $this->type), true);
}
$html .= Navigation::dropdown($this->links, $listAttributes, $this->autoroute);
$html .= '</div>';
return $html;
}
示例7: __toString
/**
* Prints out the MediaObject in memory
*
* @return string The HTML markup for the media object
*/
public function __toString()
{
// Whether objects should be printed as list elements or divs
$children = static::$listed ? 'li' : 'div';
// Open the media object
$attributes = Helpers::add_class($this->attributes, 'media');
$html = '<' . $children . Helpers::getContainer('html')->attributes($attributes) . '>';
// Add the media itself
$html .= '<a class="pull-' . $this->pull . '">';
$html .= $this->media;
$html .= '</a>';
// Add the title and body
$html .= '<div class="media-body">';
if ($this->title) {
$html .= $this->title;
}
$html .= $this->content;
// Render nested media objects (always as divs)
if ($this->nested) {
$listed = static::$listed;
static::$listed = false;
foreach ($this->nested as $mediaObject) {
$html .= $mediaObject;
}
static::$listed = $listed;
}
// Close body
$html .= '</div>';
// Close object
$html .= '</' . $children . '>';
return $html;
}
示例8: dropdown
/**
* Creates a Bootstrap Dropdown menu.
*
* @param array $list Menu items
* @param array $attributes attributes to apply the nav
* @param bool $autoroute Autoroute links
*
* @return string
*/
public static function dropdown($list, $attributes = array(), $autoroute = true)
{
$attributes = Helpers::add_class($attributes, 'dropdown-menu');
return static::menu($list, null, false, $attributes, $autoroute, true);
}
示例9: render
public function render()
{
$this->attributes = Helpers::add_class($this->attributes, 'modal');
$this->attributes = Helpers::add_class($this->attributes, "true", 'aria-hidden');
// Open the modal
$string = "<div" . Helpers::getContainer('html')->attributes(
$this->attributes
) . "><div class='modal-dialog'><div class='modal-content'>";
// Add the header
$string .= '<div class="modal-header">';
$string .= '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>';
if ($this->header) {
$string .= "<h3>" . $this->header . "</h3>";
}
$string .= "</div>";
if ($this->body) {
$string .= "<div class='modal-body'>";
$string .= $this->body;
$string .= "</div>";
}
if ($this->footer) {
$string .= "<div class='modal-footer'>";
$string .= $this->footer;
$string .= "</div>";
}
return $string . "</div></div></div>";
}
示例10: __callStatic
/**
* Allows creation of inverted navbar
*
* @param string $method The method to call
* @param array $parameters An array of parameters
*
* @return Navbar
*/
public static function __callStatic($method, $parameters)
{
if ($method == 'inverse') {
$attributes = array_get($parameters, 0);
$type = array_get($parameters, 1);
$attributes = Helpers::add_class($attributes, 'navbar-inverse');
return static::create($attributes, $type);
} else {
return static::create();
}
}
示例11: render
/**
* Prints the current button in memory
*
* @return string A button
*/
public function render()
{
// Gather variables
extract($this->currentButton);
// Add btn to classes and fallback type
if (!isset($attributes['type'])) {
$attributes['type'] = 'button';
}
$attributes = Helpers::add_class($attributes, 'btn');
// Modify output if we have a dropdown
$caret = null;
if ($hasDropdown) {
$attributes = Helpers::add_class($attributes, 'dropdown-toggle');
$caret = ' <span class="caret"></span>';
$attributes['data-toggle'] = 'dropdown';
}
// Write output according to tag
$tag = 'button';
if ($type === 'link') {
$tag = 'a';
unset($attributes['type']);
}
return '<' . $tag . Helpers::getContainer('html')->attributes($attributes) . '>' . (string) $value . $caret . '</' . $tag . '>';
}
示例12: responsive
public function responsive()
{
$this->attributes = Helpers::add_class($this->attributes, 'img-responsive');
return $this;
}
示例13: __callStatic
/**
* Checks call to see if we can create a progress bar from a magic call (for you wizards).
* normal_striped_active, info_striped, etc...
*
* @param string $method Method name
* @param array $parameters Method parameters
*
* @return mixed
*/
public static function __callStatic($method, $parameters)
{
$method_array = explode('_', strtolower($method));
$types = array('normal', 'success', 'info', 'warning', 'danger', 'automatic');
$type_found = array_intersect($method_array, $types);
if (count($type_found) > 0) {
$function = $type_found[key($type_found)];
// Set default $attributes and check for a set value
$attributes = array();
if (isset($parameters[1])) {
if (is_array($parameters[1])) {
$attributes = $parameters[1];
} else {
throw new \InvalidArgumentException(
"Tabbable attributes parameter should be an array of attributes"
);
}
}
if (in_array('striped', $method_array)) {
$attributes = Helpers::add_class($attributes, 'progress-striped');
}
if (in_array('active', $method_array)) {
$attributes = Helpers::add_class($attributes, 'active');
}
return static::$function($parameters[0], $attributes);
}
}
示例14: horizontal_dl
/**
* Creates an horizontal definition list
*
* @param array $list An array [term => description]
* @param array $attributes An array of attributes
*
* @return string A formatted <dl> list
*/
public static function horizontal_dl($list, $attributes = array())
{
$attributes = Helpers::add_class($attributes, 'dl-horizontal');
return static::dl($list, $attributes);
}
示例15: create
/**
* Creates a Bootstrap image
*
* @param string $type The image type
* @param string $url An url
* @param string $alt An alt text
* @param array $attributes An array of attributes
*
* @return string An img tag
*/
protected static function create($type, $url, $alt, $attributes)
{
$attributes = Helpers::add_class($attributes, 'img-' . $type);
return Helpers::getContainer('html')->image($url, $alt, $attributes);
}