本文整理汇总了PHP中FormAction::Name方法的典型用法代码示例。如果您正苦于以下问题:PHP FormAction::Name方法的具体用法?PHP FormAction::Name怎么用?PHP FormAction::Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormAction
的用法示例。
在下文中一共展示了FormAction::Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_cms_actions
/**
* @param FieldSet $actions
* @parma SiteTree $page
*/
public static function update_cms_actions(&$actions, $page)
{
$openRequest = $page->OpenWorkflowRequest();
// if user doesn't have publish rights
if (!$page->canPublish() || $openRequest) {
// authors shouldn't be able to revert, as this republishes the page.
// they should rather change the page and re-request publication
$actions->removeByName('action_revert');
}
// Remove the one click publish if they are not an admin/workflow admin.
if (self::$force_publishers_to_use_workflow && !Permission::checkMember(Member::currentUser(), 'IS_WORKFLOW_ADMIN')) {
$actions->removeByName('action_publish');
}
// Remove the save & publish button if you don't have edit rights
if (!$page->canEdit()) {
$actions->removeByName('action_publish');
}
$liveVersion = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree_Live\".\"ID\" = {$page->ID}");
if ($liveVersion && $liveVersion->ExpiryDate != null && $liveVersion->ExpiryDate != '0000-00-00 00:00:00') {
if ($page->canApprove()) {
$actions->push(new FormAction('cms_cancelexpiry', _t('WorkflowPublicationRequest.BUTTONCANCELEXPIRY', 'Cancel expiry')));
}
}
// Optional method
$isPublishable = $page->hasMethod('isPublishable') ? $page->isPublishable() : true;
if (!$openRequest && $page->canEdit() && $isPublishable && $page->stagesDiffer('Stage', 'Live') && ($page->Version > 1 || $page->Title != "New Page") && !$page->IsDeletedFromStage && (!$page->canPublish() || self::$publisher_can_create_wf_requests)) {
$actions->push($requestPublicationAction = new FormAction('cms_requestpublication', _t('SiteTreeCMSWorkflow.BUTTONREQUESTPUBLICATION', 'Request Publication')));
// don't allow creation of a second request by another author
if (!self::can_create(null, $page)) {
$actions->makeFieldReadonly($requestPublicationAction->Name());
}
}
}
示例2: update_cms_actions
/**
* @param FieldSet $actions
* @parma SiteTree $page
*/
public static function update_cms_actions(&$actions, $page)
{
$openRequest = $page->OpenWorkflowRequest();
// if user doesn't have publish rights, exchange the behavior from
// "publish" to "request publish" etc.
if (!$page->canDeleteFromLive() || $openRequest) {
// "request removal"
$actions->removeByName('action_deletefromlive');
}
if (!$openRequest && $page->canEdit() && (!$page->canPublish() || self::$publisher_can_create_wf_requests) && $page->IsDeletedFromStage) {
if ($page->ExistsOnLive) {
$actions->push($requestDeletionAction = new FormAction('cms_requestdeletefromlive', _t('SiteTreeCMSWorkflow.BUTTONREQUESTREMOVAL', 'Request Removal')));
}
// don't allow creation of a second request by another author
if (!self::can_create(null, $page)) {
$actions->makeFieldReadonly($requestDeletionAction->Name());
}
}
// @todo deny deletion
}