本文整理汇总了PHP中ElggMenuItem::setConfirmText方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggMenuItem::setConfirmText方法的具体用法?PHP ElggMenuItem::setConfirmText怎么用?PHP ElggMenuItem::setConfirmText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggMenuItem
的用法示例。
在下文中一共展示了ElggMenuItem::setConfirmText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hover_menu
function hover_menu($hook, $type, $return, $params)
{
$user = $params['entity'];
if ($user->spam_throttle_suspension > time() && elgg_is_admin_logged_in()) {
$url = "action/spam_throttle/unsuspend?guid={$user->guid}";
$item = new \ElggMenuItem("spam_throttle_unsuspend", elgg_echo("spam_throttle:unsuspend"), $url);
$item->setConfirmText(elgg_echo('spam_throttle:unsuspend:confirm'));
$item->setSection('admin');
$return[] = $item;
}
return $return;
}
示例2: translation_editor_user_hover_menu
function translation_editor_user_hover_menu($hook, $type, $return, $params)
{
$user = $params['entity'];
if (elgg_is_admin_logged_in() && !$user->isAdmin()) {
// TODO: replace with a single toggle editor action?
if (translation_editor_is_translation_editor($user->getGUID())) {
$url = "action/translation_editor/unmake_translation_editor?user=" . $user->getGUID();
$title = elgg_echo("translation_editor:action:unmake_translation_editor");
} else {
$url = "action/translation_editor/make_translation_editor?user=" . $user->getGUID();
$title = elgg_echo("translation_editor:action:make_translation_editor");
}
$item = new ElggMenuItem('translation_editor', $title, $url);
$item->setSection('admin');
$item->setConfirmText(elgg_echo("question:areyousure"));
$return[] = $item;
return $return;
}
}
示例3: elgg_user_hover_menu
/**
* Setup the default user hover menu
* @access private
*/
function elgg_user_hover_menu($hook, $type, $return, $params)
{
$user = $params['entity'];
/* @var \ElggUser $user */
if (elgg_is_logged_in()) {
if (elgg_get_logged_in_user_guid() == $user->guid) {
$url = "profile/{$user->username}/edit";
$item = new \ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
$item->setSection('action');
$return[] = $item;
$url = "avatar/edit/{$user->username}";
$item = new \ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
$item->setSection('action');
$return[] = $item;
}
}
// prevent admins from banning or deleting themselves
if (elgg_get_logged_in_user_guid() == $user->guid) {
return $return;
}
if (elgg_is_admin_logged_in()) {
$actions = array();
if (!$user->isBanned()) {
$actions[] = 'ban';
} else {
$actions[] = 'unban';
}
$actions[] = 'delete';
$actions[] = 'resetpassword';
if (!$user->isAdmin()) {
$actions[] = 'makeadmin';
} else {
$actions[] = 'removeadmin';
}
foreach ($actions as $action) {
$url = "action/admin/user/{$action}?guid={$user->guid}";
$url = elgg_add_action_tokens_to_url($url);
$item = new \ElggMenuItem($action, elgg_echo($action), $url);
$item->setSection('admin');
$item->setConfirmText(true);
$return[] = $item;
}
$url = "profile/{$user->username}/edit";
$item = new \ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
$item->setSection('admin');
$return[] = $item;
$url = "avatar/edit/{$user->username}";
$item = new \ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
$item->setSection('admin');
$return[] = $item;
$url = "settings/user/{$user->username}";
$item = new \ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url);
$item->setSection('admin');
$return[] = $item;
$url = "activity/owner/{$user->username}";
$item = new \ElggMenuItem('activity:owner', elgg_echo('activity:owner'), $url);
$item->setSection('action');
$return[] = $item;
}
return $return;
}
示例4: comment_entity_menu
/**
* modify the entity menu for unapproved comments
*
* @param type $hook
* @param type $type
* @param array $return
* @param array $params
* @return array
*/
function comment_entity_menu($hook, $type, $return, $params)
{
if (!$params['entity'] instanceof \ElggComment) {
return $return;
}
if ($params['entity']->isEnabled()) {
return $return;
}
$entity = $params['entity']->getContainerEntity();
if ($entity && $entity->canEdit()) {
$return = array();
$href = elgg_add_action_tokens_to_url('action/comments/moderate?guid[]=' . $params['entity']->guid . '&review=approve');
$item = new \ElggMenuItem('approve', elgg_echo('Au_anonymous_comments:approve'), $href);
$return[] = $item;
$delete_url = elgg_add_action_tokens_to_url('action/comments/moderate?guid[]=' . $params['entity']->guid . '&review=delete');
$item = new \ElggMenuItem('delete', elgg_view_icon('delete'), $delete_url);
$item->setConfirmText(elgg_echo('question:areyousure'));
$return[] = $item;
$return = array_values($return);
}
return $return;
}