本文整理汇总了PHP中JToolbarHelper::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP JToolbarHelper::assign方法的具体用法?PHP JToolbarHelper::assign怎么用?PHP JToolbarHelper::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JToolbarHelper
的用法示例。
在下文中一共展示了JToolbarHelper::assign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderToolbarElement
/**
* Render a toolbar element.
*
* @param string $type The element type.
* @param mixed $value The element value.
* @param array $attributes The element attributes.
*
* @return void
*
* @throws InvalidArgumentException
*/
private function renderToolbarElement($type, $value = null, array $attributes = array())
{
switch ($type) {
case 'title':
$icon = isset($attributes['icon']) ? $attributes['icon'] : 'generic.png';
JToolbarHelper::title($value, $icon);
break;
case 'divider':
JToolbarHelper::divider();
break;
case 'custom':
$task = isset($attributes['task']) ? $attributes['task'] : '';
$icon = isset($attributes['icon']) ? $attributes['icon'] : '';
$iconOver = isset($attributes['icon_over']) ? $attributes['icon_over'] : '';
$alt = isset($attributes['alt']) ? $attributes['alt'] : '';
$listSelect = isset($attributes['list_select']) ? FOFStringUtils::toBool($attributes['list_select']) : true;
JToolbarHelper::custom($task, $icon, $iconOver, $alt, $listSelect);
break;
case 'preview':
$url = isset($attributes['url']) ? $attributes['url'] : '';
$update_editors = isset($attributes['update_editors']) ? FOFStringUtils::toBool($attributes['update_editors']) : false;
JToolbarHelper::preview($url, $update_editors);
break;
case 'help':
if (!isset($attributes['help'])) {
throw new InvalidArgumentException('The help attribute is missing in the help button type.');
}
$ref = $attributes['help'];
$com = isset($attributes['com']) ? FOFStringUtils::toBool($attributes['com']) : false;
$override = isset($attributes['override']) ? $attributes['override'] : null;
$component = isset($attributes['component']) ? $attributes['component'] : null;
JToolbarHelper::help($ref, $com, $override, $component);
break;
case 'back':
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_BACK';
$href = isset($attributes['href']) ? $attributes['href'] : 'javascript:history.back();';
JToolbarHelper::back($alt, $href);
break;
case 'media_manager':
$directory = isset($attributes['directory']) ? $attributes['directory'] : '';
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_UPLOAD';
JToolbarHelper::media_manager($directory, $alt);
break;
case 'assign':
$task = isset($attributes['task']) ? $attributes['task'] : 'assign';
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_ASSIGN';
JToolbarHelper::assign($task, $alt);
break;
case 'new':
if ($this->perms->create) {
$task = isset($attributes['task']) ? $attributes['task'] : 'add';
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_NEW';
$check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : false;
JToolbarHelper::addNew($task, $alt, $check);
}
break;
case 'publish':
if ($this->perms->editstate) {
$task = isset($attributes['task']) ? $attributes['task'] : 'publish';
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_PUBLISH';
$check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : false;
JToolbarHelper::publish($task, $alt, $check);
}
break;
case 'publishList':
if ($this->perms->editstate) {
$task = isset($attributes['task']) ? $attributes['task'] : 'publish';
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_PUBLISH';
JToolbarHelper::publishList($task, $alt);
}
break;
case 'unpublish':
if ($this->perms->editstate) {
$task = isset($attributes['task']) ? $attributes['task'] : 'unpublish';
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_UNPUBLISH';
$check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : false;
JToolbarHelper::unpublish($task, $alt, $check);
}
break;
case 'unpublishList':
if ($this->perms->editstate) {
$task = isset($attributes['task']) ? $attributes['task'] : 'unpublish';
$alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_UNPUBLISH';
JToolbarHelper::unpublishList($task, $alt);
}
break;
case 'archiveList':
if ($this->perms->editstate) {
$task = isset($attributes['task']) ? $attributes['task'] : 'archive';
//.........这里部分代码省略.........