本文整理汇总了PHP中HtmlHelper::formatAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::formatAttributes方法的具体用法?PHP HtmlHelper::formatAttributes怎么用?PHP HtmlHelper::formatAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper::formatAttributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorMessage
static function errorMessage($message, $name = '', $attributes = array())
{
if (!isset($attributes['class'])) {
$attributes['class'] = 'error-message';
}
if (!$message) {
if (!isset($attributes['style'])) {
$attributes['style'] = '';
}
$attributes['style'] .= ';display:none;';
}
if ($name != '' && !isset($attributes['id'])) {
//Warning: This doesn't work with page with multiple forms
$attributes['id'] = 'error-message-' . $name;
}
$message = HtmlHelper::escape($message);
$attributes = HtmlHelper::formatAttributes($attributes);
return "<div {$attributes}>{$message}</div>";
}
示例2: open
final function open($attributes = array())
{
$html_id = $this->_id;
if (isset($attributes['id'])) {
$html_id = $attributes['id'];
unset($attributes['id']);
}
$attributes = HtmlHelper::formatAttributes($attributes);
$validation_script = '';
if ($this->_client_validation_enabled) {
$this->enableClientValidation();
$validation_script = HtmlHelper::inlineJavascript("Phaxsi.Validator.Current = Phaxsi.Validator.List['{$html_id}'] = new Phaxsi.Validator.Manager('{$html_id}');\r\n" . "Phaxsi.Validator.DefaultErrorMessages = " . JsonHelper::encode(Validator::getDefaultErrorMessages()) . ";");
$this->_javascript .= HtmlHelper::inlineJavascript("Phaxsi.Validator.Current.attachToSubmit();");
}
#For xhtml strict compliance
$target_str = $this->_target == '_self' ? '' : 'target="' . $this->_target . '"';
return "<form id=\"{$html_id}\" accept-charset=\"" . $this->_charset . "\" action=\"" . HtmlHelper::escape($this->_action) . "\" method=\"{$this->_method}\" {$attributes} {$target_str} enctype=\"{$this->_enc_type}\">\r\n" . $validation_script;
}
示例3: paragraph
static function paragraph($text, $attributes = "")
{
$att = HtmlHelper::formatAttributes($attributes);
return preg_replace("/\\b.+/", '<p ' . $att . '>$0</p>', $text);
}
示例4: foreach
<div class="viewer">
<?php
foreach ($rows as $row) {
?>
<table class="main">
<tr>
<?php
foreach ($row as $i => $section) {
?>
<td class="section <?php
echo $i == 0 ? 'first' : '';
?>
" <?php
echo HtmlHelper::formatAttributes($section['attributes']);
?>
>
<?php
if (!empty($section['title'])) {
?>
<h3><?php
echo $section['title'];
?>
</h3>
<?php
}
?>
<?php