本文整理汇总了PHP中BsHtml::addCssClass方法的典型用法代码示例。如果您正苦于以下问题:PHP BsHtml::addCssClass方法的具体用法?PHP BsHtml::addCssClass怎么用?PHP BsHtml::addCssClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BsHtml
的用法示例。
在下文中一共展示了BsHtml::addCssClass方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileField
public function fileField($model, $attribute, $htmlOptions = array())
{
$controlOptions = BsArray::popValue('controlOptions', $htmlOptions, array());
$labelOptions = BsArray::popValue('labelOptions', $htmlOptions, array());
$layout = $this->layout;
$output = '';
$output .= CHtml::activeFileField($model, $attribute, $htmlOptions);
$attr = $model->{$attribute};
if (!empty($attr)) {
//Special logic for ContentTypes
$tmpModel = $model;
if ($model instanceof ContentType) {
$tmpModel = $model->Content;
}
$output .= '<p class="file">' . CHtml::link($model->{$attribute}, array('/site/getFile', 'id' => $tmpModel->id, 'field' => $attribute, 'modelName' => get_class($tmpModel))) . '</p>';
$output .= '<div class="checkbox">' . CHtml::checkBox($attribute . '_delete');
$output .= CHtml::label('Delete?', $attribute . '_delete') . '</div>';
}
$htmlOptions['input'] = $output;
$htmlOptions['labelOptions'] = BsHtml::setLabelOptionsByLayout($layout, $labelOptions);
if (!empty($layout)) {
if ($layout === BsHtml::FORM_LAYOUT_HORIZONTAL) {
$controlClass = BsArray::popValue('class', $controlOptions, BsHtml::$formLayoutHorizontalControlClass);
BsHtml::addCssClass($controlClass, $htmlOptions['controlOptions']);
}
}
return BsHTML::activeTextFieldControlGroup($model, $attribute, $htmlOptions);
}
示例2: init
/**
* Initializes the widget.
*/
public function init()
{
$this->attachBehavior('BsWidget', new BsWidget());
$this->copyId();
$route = $this->controller->getRoute();
if ($this->stacked) {
BsHtml::addCssClass('nav-stacked', $this->htmlOptions);
}
$pull = BsArray::popValue('pull', $this->htmlOptions);
if (!empty($pull)) {
if ($pull === BsHtml::NAVBAR_NAV_PULL_RIGHT || $pull === BsHtml::NAVBAR_NAV_PULL_LEFT) {
BsHtml::addCssClass('navbar-' . $pull, $this->htmlOptions);
}
}
$this->items = $this->normalizeItems($this->items, $route, $hasActiveChild);
}
示例3: init
/**
* Initializes the widget.
*/
public function init()
{
Yii::app()->clientScript->registerCoreScript('jquery');
$this->attachBehavior('BsWidget', new BsWidget());
$this->copyId();
BsHtml::addCssClass('collapse', $this->htmlOptions);
if (isset($this->parent)) {
BsArray::defaultValue('data-parent', $this->parent, $this->htmlOptions);
}
if (isset($this->toggle) && $this->toggle) {
BsHtml::addCssClass('in', $this->htmlOptions);
}
if (isset($this->view)) {
$controller = $this->getController();
if (isset($controller) && $controller->getViewFile($this->view) !== false) {
$this->content = $this->controller->renderPartial($this->view, $this->viewData, true);
}
}
echo BsHtml::openTag($this->tagName, $this->htmlOptions);
echo $this->content;
}
示例4: setLabelOptionsByLayout
/**
* set the label CssClass by Layout
* @param string $layout
* @param array $labelOptions
* @return array new label options
*/
public static function setLabelOptionsByLayout($layout, $labelOptions = array())
{
if (empty($layout)) {
BsHtml::addCssClass('control-label', $labelOptions);
return $labelOptions;
}
if ($layout === BsHtml::FORM_LAYOUT_INLINE) {
BsHtml::addCssClass('control-label', $labelOptions);
BsHtml::addCssClass('sr-only', $labelOptions);
return $labelOptions;
}
$labelClass = BsArray::popValue('class', $labelOptions, BsHtml::$formLayoutHorizontalLabelClass);
BsHtml::addCssClass('control-label', $labelOptions);
BsHtml::addCssClass($labelClass, $labelOptions);
return $labelOptions;
}
示例5: run
/**
* Runs the widget.
*/
public function run()
{
$brand = $this->brandLabel !== false ? BsHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
ob_start();
foreach ($this->items as $item) {
if (is_string($item)) {
echo $item;
} else {
$widgetClassName = BsArray::popValue('class', $item);
if ($widgetClassName !== null) {
$this->controller->widget($widgetClassName, $item);
}
}
}
$items = ob_get_clean();
ob_start();
if ($this->collapse !== false) {
BsHtml::addCssClass('collapse navbar-collapse', $this->collapseOptions);
ob_start();
/* @var BsCollapse $collapseWidget */
$collapseWidget = $this->controller->widget('bootstrap.widgets.BsCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
$collapseContent = ob_get_clean();
$collapseLink = BsHtml::navbarCollapseLink('#' . $collapseWidget->getId());
echo BsHtml::tag('div', array('class' => 'navbar-header'), $collapseLink . $brand) . $collapseContent;
} else {
echo BsHtml::tag('div', array('class' => 'navbar-header'), $brand) . $items;
}
$containerContent = ob_get_clean();
if (isset($this->position) && ($this->position === BsHtml::NAVBAR_POSITION_FIXED_TOP || $this->position === BsHtml::NAVBAR_POSITION_STATIC_TOP)) {
$fluid = BsArray::popValue('containerOptions', $this->htmlOptions, false);
$containerOptions = BsArray::popValue('containerOptions', $this->htmlOptions, array());
$containerClass = 'container';
if ($fluid) {
$containerOptions = BsArray::removeValue('fluid', $this->htmlOptions, array());
$containerClass = 'container-fluid';
}
BsHtml::addCssClass($containerClass, $containerOptions);
$content = BsHtml::tag('div', $containerOptions, $containerContent);
echo BsHtml::navbar($content, $this->htmlOptions);
return;
}
echo BsHtml::navbar($containerContent, $this->htmlOptions);
}
示例6: init
/**
* Widget's initialization method
*/
public function init()
{
$this->attachBehavior('BsWidget', new BsWidget());
BsArray::defaultValue('id', $this->getId(), $this->htmlOptions);
BsArray::defaultValue('role', 'dialog', $this->htmlOptions);
BsArray::defaultValue('tabindex', '-1', $this->htmlOptions);
BsHtml::addCssClass('modal', $this->htmlOptions);
if ($this->fade) {
BsHtml::addCssClass('fade', $this->htmlOptions);
}
if ($this->show) {
BsHtml::addCssClass('in', $this->htmlOptions);
}
if (is_array($this->footer)) {
$this->footer = implode(' ', $this->footer);
}
$this->initOptions();
$this->initEvents();
}
示例7: errorSummary
/**
* Displays a summary of validation errors for one or several models.
* @param mixed $models the models whose input errors are to be displayed.
* @param string $header a piece of HTML code that appears in front of the errors
* @param string $footer a piece of HTML code that appears at the end of the errors
* @param array $htmlOptions additional HTML attributes to be rendered in the container div tag.
* @return string the error summary. Empty if no errors are found.
*/
public function errorSummary($models, $header = null, $footer = null, $htmlOptions = array())
{
if (!$this->enableAjaxValidation && !$this->enableClientValidation) {
return BsHtml::errorSummary($models, $header, $footer, $htmlOptions);
}
BsArray::defaultValue('id', $this->id . '_es_', $htmlOptions);
$html = BsHtml::errorSummary($models, $header, $footer, $htmlOptions);
if ($html === '') {
if ($header === null) {
$header = '<p>' . Yii::t('yii', 'Please fix the following input errors:') . '</p>';
}
BsHtml::addCssClass(BsHtml::$errorSummaryCss, $htmlOptions);
BsHtml::addCssStyle('display:none', $htmlOptions);
$html = CHtml::tag('div', $htmlOptions, $header . '<ul><li>dummy</li></ul>' . $footer);
}
$this->summaryID = $htmlOptions['id'];
foreach (is_array($models) ? $models : array($models) as $model) {
foreach ($model->getSafeAttributeNames() as $attribute) {
$this->_summaryAttributes[] = CHtml::activeId($model, $attribute);
}
}
return $html;
}