static function context_menu($menu, $theme, $item, $thumb_css_selector) { if (hide::can_be_hidden($item) && hide::can_hide($item)) { $csrf = access::csrf_token(); $link = self::_get_hide_link_data($item); $menu->get("options_menu")->append(Menu::factory("ajax_link")->label($link["text"])->ajax_handler("function(data) { window.location.reload() }")->url(url::site("display/" . $link["action"] . "/{$item->id}?csrf={$csrf}"))); } }
/** * Checks whether the given object can be hidden by the active user. * * @param Item_Model $item the item */ private function _check_hide_permissions(Item_Model $item) { access::verify_csrf(); access::required("view", $item); access::required("edit", $item); if (!hide::can_hide()) { access::forbidden(); } }