本文整理汇总了PHP中Collective\Html\HtmlBuilder::attributes方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlBuilder::attributes方法的具体用法?PHP HtmlBuilder::attributes怎么用?PHP HtmlBuilder::attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collective\Html\HtmlBuilder
的用法示例。
在下文中一共展示了HtmlBuilder::attributes方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* Create <div> tag for a reCAPTCHA widget
*
* @param array $options
*
* @return string
*/
public function widget(array $options = [])
{
$options['sitekey'] = $this->siteKey;
if (isset($options['class'])) {
$options['class'] .= ' ' . $this->recaptchaClass;
} else {
$options['class'] = $this->recaptchaClass;
}
$this->renameOptions($options);
return '<div' . $this->html->attributes($options) . '></div>' . PHP_EOL;
}
示例2: button
/**
* Create a button element.
*
* @param string $value
* @param array $options
* @return string
*/
public function button($value = null, $options = array())
{
if (!array_key_exists('type', $options)) {
$options['type'] = 'button';
}
return '<button' . $this->html->attributes($options) . '>' . $value . '</button>';
}
示例3: styles
/**
* Return an array of style tags.
*
* @param $collection
* @param array $filters
* @param array $attributes
* @return array
*/
public function styles($collection, array $filters = [], array $attributes = [])
{
return array_map(function ($path) use($attributes) {
$defaults = ['media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'];
$attributes = $attributes + $defaults;
$attributes['href'] = $path;
return '<link' . $this->html->attributes($attributes) . '>';
}, $this->paths($collection, $filters));
}
示例4: compileTableHeaders
/**
* Compile table headers and to support responsive extension.
*
* @return array
*/
private function compileTableHeaders()
{
$th = [];
foreach ($this->collection->toArray() as $row) {
$thAttr = $this->html->attributes(array_only($row, ['class', 'id', 'width', 'style', 'data-class', 'data-hide']));
$th[] = '<th ' . $thAttr . '>' . $row['title'] . '</th>';
}
return $th;
}
示例5: button
/**
* Create a button element.
*
* @param string $value
* @param array $options
* @param bool $escape
*
* @return \Illuminate\Support\HtmlString
*/
public function button($value = null, $options = [], $escape = true)
{
if (!array_key_exists('type', $options)) {
$options['type'] = 'button';
}
if ($escape) {
$value = $this->html->entities($value);
}
return $this->toHtmlString('<button' . $this->html->attributes($options) . '>' . $value . '</button>');
}
示例6: attributes
public function attributes($attributes)
{
$name_prefix = keyVal('name_prefix', $attributes, $this->name_prefix);
if ($name_prefix && is_array($attributes) && array_key_exists('name', $attributes)) {
$attributes['name'] = $name_prefix . '[' . $attributes['name'] . ']';
}
if (is_array($attributes)) {
unset($attributes['name_prefix']);
}
/** Automate using BS4 tether Tooltips */
if (is_array($attributes) && array_key_exists('tooltip', $attributes)) {
$attributes['data-toggle'] = 'tooltip';
$attributes['title'] = html_encode($attributes['tooltip']);
unset($attributes['tooltip']);
}
unset($attributes['']);
unset($attributes[null]);
unset($attributes[0]);
return parent::attributes($attributes);
}
示例7: attributes
/**
* Build an HTML attribute string from an array.
*
* @param array $attributes
* @return string
* @static
*/
public static function attributes($attributes)
{
return \Collective\Html\HtmlBuilder::attributes($attributes);
}
示例8: getFormGroup
/**
* Get a form group.
*
* @param string $name
* @param string $element
*
* @return string
*/
public function getFormGroup($name = null, $element)
{
$options = $this->getFormGroupOptions($name);
return '<div' . $this->html->attributes($options) . '>' . $element . '</div>';
}
示例9: attributes
/**
* Converts the defined attributes into HTML.
*
* @param array $attributes
* @return string
*/
public function attributes($attributes = array())
{
return $this->html->attributes($attributes);
}
示例10: getFormGroup
/**
* Get a form group.
*
* @param string $name
* @param string $element
* @return string
*/
public function getFormGroup($name = null, $element, $extra = null)
{
$options = $this->getFormGroupOptions($name);
$element = substr($element, 0, strlen($element) - 6) . $extra . substr($element, -6);
return '<div' . $this->html->attributes($options) . '>' . $element . '</div>';
}
示例11: table
/**
* Generate DataTable's table html
*
* @param array $attributes
* @return string
*/
public function table(array $attributes = [])
{
$this->tableAttributes = $attributes ?: $this->tableAttributes;
return '<table' . $this->html->attributes($this->tableAttributes) . '></table>';
}
示例12: table
/**
* Generate DataTable's table html.
*
* @param array $attributes
* @return string
*/
public function table(array $attributes = [])
{
$this->tableAttributes = array_merge($this->tableAttributes, $attributes);
return '<table ' . $this->html->attributes($this->tableAttributes) . '></table>';
}
示例13: source
/**
* Return a source tag.
*
* @return string
*/
public function source()
{
$this->addAttribute('srcset', $this->srcset() ?: $this->path() . ' 2x, ' . $this->path() . ' 1x');
$attributes = $this->html->attributes($this->getAttributes());
if ($srcset = $this->srcset()) {
$attributes['srcset'] = $srcset;
}
return "<source {$attributes}>";
}