本文整理汇总了PHP中XenForo_Template_Helper_Core::addClass方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Helper_Core::addClass方法的具体用法?PHP XenForo_Template_Helper_Core::addClass怎么用?PHP XenForo_Template_Helper_Core::addClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Template_Helper_Core
的用法示例。
在下文中一共展示了XenForo_Template_Helper_Core::addClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listItem
/**
* Returns a list item element.
*
* @param array $controlOptions Options relating to the item
* @param array $popups A list of popups (HTML) that belong to the item
*
* @return string List row HTML
*/
public static function listItem(array $controlOptions, array $popups)
{
// active toggle handler
if (isset($controlOptions['toggle'])) {
if ($controlOptions['toggle']) {
$toggleChecked = ' checked="checked"';
} else {
$toggleChecked = '';
XenForo_Template_Helper_Core::addClass('disabled', $controlOptions['labelclass']);
}
if (!empty($controlOptions['toggletitle'])) {
$toggleClass = ' Tooltip';
$toggleTitle = " title=\"{$controlOptions['toggletitle']}\" data-tipclass=\"flipped\" data-offsetx=\"2\" data-offsety=\"-2\"";
} else {
$toggleTitle = '';
}
$toggle = '
<input type="hidden" name="exists[' . $controlOptions['id'] . ']" value="1" />
<label class="toggler secondaryContent' . $toggleClass . '"' . $toggleTitle . '><input type="checkbox" name="id[' . $controlOptions['id'] . ']" value="1" ' . $toggleChecked . ' class="SubmitOnChange Toggler" /></label>';
} else {
$toggle = '';
}
if (!empty($controlOptions['selectable'])) {
$selectName = isset($controlOptions['selectname']) ? $controlOptions['selectname'] : '';
$selectValue = isset($controlOptions['selectvalue']) ? $controlOptions['selectvalue'] : $controlOptions['id'];
$selectDisabled = !empty($controlOptions['selectdisabled']) ? ' disabled="disabled"' : '';
if (!empty($controlOptions['selecttooltip'])) {
$selectTitle = ' title="' . $controlOptions['selecttooltip'] . '"';
$selectClass = ' Tooltip';
} else {
$selectTitle = '';
$selectClass = '';
}
$select = '<label class="secondaryContent selectListItem' . $selectClass . '"' . $selectTitle . '><input type="checkbox" name="' . $selectName . '" value="' . $selectValue . '" ' . (!empty($controlOptions['selected']) ? ' checked="checked"' : '') . $selectDisabled . ' /></label>';
} else {
$select = '';
}
if (!empty($controlOptions['tooltip'])) {
$tooltip = ' title="' . $controlOptions['tooltip'] . '" data-offsetx="10"';
XenForo_Template_Helper_Core::addClass('Tooltip', $controlOptions['linkclass']);
} else {
$tooltip = '';
}
$dataOptions = '';
foreach ($controlOptions as $controlOptionId => $controlOptionValue) {
if (substr($controlOptionId, 0, 5) == 'data-') {
$dataOptions .= " {$controlOptionId}=\"{$controlOptionValue}\"";
}
}
$extraClasses = !empty($controlOptions['class']) ? ' ' . $controlOptions['class'] : '';
$labelClass = !empty($controlOptions['labelclass']) ? ' class="' . $controlOptions['labelclass'] . '"' : '';
$linkClass = !empty($controlOptions['linkclass']) ? ' class="' . $controlOptions['linkclass'] . '"' : '';
$href = !empty($controlOptions['href']) ? $controlOptions['href'] : '';
$target = !empty($controlOptions['target']) ? $controlOptions['target'] : '';
$linkStyle = !empty($controlOptions['linkstyle']) ? ' style="' . $controlOptions['linkstyle'] . '"' : '';
$beforeLabel = !empty($controlOptions['beforelabel']) ? $controlOptions['beforelabel'] : '';
if (empty($controlOptions['delete'])) {
$delete = '';
} else {
$deletePhrase = new XenForo_Phrase('delete') . '...';
$deleteHint = !empty($controlOptions['deletehint']) ? $controlOptions['deletehint'] : $deletePhrase;
if ($controlOptions['delete'] === '#') {
$delete = '<a class="delete secondaryContent"></a>' . "\n";
} else {
$delete = '<a href="' . $controlOptions['delete'] . '" class="delete OverlayTrigger secondaryContent" title="' . $deleteHint . '"><span>' . $deletePhrase . '</span></a>' . "\n";
}
}
$href = $href ? ' href="' . $href . '"' : '';
$target = $target ? ' target="' . $target . '"' : '';
$output = '
<li class="listItem primaryContent' . $extraClasses . '" id="' . self::getListItemId($controlOptions['id']) . '"' . $dataOptions . '>
' . $delete . '
' . $select . '
' . (!empty($controlOptions['html']) ? $controlOptions['html'] : '') . '
';
$popupOutput = '';
foreach ($popups as $popup) {
if ($popup !== '') {
$popupOutput = $popup . "\n" . $popupOutput;
}
}
$output .= $popupOutput;
$output .= '
<h4' . $labelClass . '>' . $toggle . $beforeLabel . '
<a' . $href . $linkClass . $linkStyle . $tooltip . $target . '>
<em>' . $controlOptions['label'] . '</em>' . (!empty($controlOptions['snippet']) ? '
<dfn>' . $controlOptions['snippet'] . '</dfn>' : '') . '
</a></h4>
</li>
';
return $output;
}