當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FieldSet::removeByName方法代碼示例

本文整理匯總了PHP中FieldSet::removeByName方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::removeByName方法的具體用法?PHP FieldSet::removeByName怎麽用?PHP FieldSet::removeByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FieldSet的用法示例。


在下文中一共展示了FieldSet::removeByName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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());
         }
     }
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-cmsworkflow,代碼行數:37,代碼來源:WorkflowPublicationRequest.php

示例2: getCMSFields

 function getCMSFields()
 {
     $fields = new FieldSet(new TextField('SearchPhrase', 'Search For'), new TextField('SearchTitle', 'Title'), new TextField('SearchSubject', 'Subject'));
     $fields->merge(parent::getCMSFields());
     $fields->removeByName('TwitterUser');
     return $fields;
 }
開發者ID:hamishcampbell,項目名稱:silverstripe-twitter-widgets,代碼行數:7,代碼來源:TwitterSearchWidget.php

示例3: updateCMSFields

 function updateCMSFields(FieldSet &$fields)
 {
     if ($this->owner->ID && $this->owner->Code == strtolower(self::$main_group)) {
         $newMerchants = new ComplexTableField(Controller::has_curr() ? Controller::curr() : new Controller(), 'NewMembers', 'Member');
         $newMerchants->setCustomSourceItems(self::get_new_merchants());
         $fields->addFieldToTab('Root', new Tab(_t('MerchantGroupDOD.NEWMERCHANTS', 'New Merchants'), $newMerchants), 'Members');
         $fields->findOrMakeTab('Root.Members')->setTitle(_t('MerchantGroupDOD.ALLMERCHANTS', 'All Merchants'));
         $fields->removeByName('Title');
     }
 }
開發者ID:helpfulrobot,項目名稱:sunnysideup-ecommerce-merchants,代碼行數:10,代碼來源:MerchantGroupDOD.php

示例4: updateCMSFields

 /**
  * Fields to display this {@link Payment} in the CMS, removed some of the 
  * unnecessary fields.
  * 
  * @see DataObjectDecorator::updateCMSFields()
  * @return FieldSet
  */
 function updateCMSFields(FieldSet &$fields)
 {
     $toBeRemoved = array('IP', 'ProxyIP', 'PaidForID', 'PaidForClass', 'PaymentDate', 'ExceptionError', 'Token', 'PayerID', 'RecurringPaymentID');
     foreach ($toBeRemoved as $field) {
         $fields->removeByName($field);
     }
     $toBeReadOnly = array('TransactionID', 'PaidByID');
     foreach ($toBeReadOnly as $field) {
         if ($fields->fieldByName($field)) {
             $fields->makeFieldReadonly($field);
         }
     }
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:21,代碼來源:PaymentDecorator.php

示例5: 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
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-cmsworkflow,代碼行數:24,代碼來源:WorkflowDeletionRequest.php

示例6: getCMSFields

 /**
  * Returns a FieldSet with which to create the CMS editing form.
  *
  * You can override this in your child classes to add extra fields - first
  * get the parent fields using parent::getCMSFields(), then use
  * addFieldToTab() on the FieldSet.
  *
  * @return FieldSet The fields to be displayed in the CMS.
  */
 function getCMSFields()
 {
     require_once "forms/Form.php";
     Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
     Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
     Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
     Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/UpdateURL.js');
     // Status / message
     // Create a status message for multiple parents
     if ($this->ID && is_numeric($this->ID)) {
         $linkedPages = $this->VirtualPages();
     }
     $parentPageLinks = array();
     if (isset($linkedPages)) {
         foreach ($linkedPages as $linkedPage) {
             $parentPage = $linkedPage->Parent;
             if ($parentPage) {
                 if ($parentPage->ID) {
                     $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/{$linkedPage->ID}\">{$parentPage->Title}</a>";
                 } else {
                     $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/{$linkedPage->ID}\">" . _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . "</a>";
                 }
             }
         }
         $lastParent = array_pop($parentPageLinks);
         $parentList = "'{$lastParent}'";
         if (count($parentPageLinks) > 0) {
             $parentList = "'" . implode("', '", $parentPageLinks) . "' and " . $parentList;
         }
         $statusMessage[] = sprintf(_t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the %s sections."), $parentList);
     }
     if ($this->HasBrokenLink || $this->HasBrokenFile) {
         $statusMessage[] = _t('SiteTree.HASBROKENLINKS', "This page has broken links.");
     }
     $message = "STATUS: {$this->Status}<br />";
     if (isset($statusMessage)) {
         $message .= "NOTE: " . implode("<br />", $statusMessage);
     }
     $dependentNote = '';
     $dependentTable = new LiteralField('DependentNote', '<p></p>');
     // Create a table for showing pages linked to this one
     $dependentPagesCount = $this->DependentPagesCount();
     if ($dependentPagesCount) {
         $dependentColumns = array('Title' => $this->fieldLabel('Title'), 'AbsoluteLink' => _t('SiteTree.DependtPageColumnURL', 'URL'), 'DependentLinkType' => _t('SiteTree.DependtPageColumnLinkType', 'Link type'));
         if (class_exists('Subsite')) {
             $dependentColumns['Subsite.Title'] = singleton('Subsite')->i18n_singular_name();
         }
         $dependentNote = new LiteralField('DependentNote', '<p>' . _t('SiteTree.DEPENDENT_NOTE', 'The following pages depend on this page. This includes virtual pages, redirector pages, and pages with content links.') . '</p>');
         $dependentTable = new TableListField('DependentPages', 'SiteTree', $dependentColumns);
         $dependentTable->setCustomSourceItems($this->DependentPages());
         $dependentTable->setFieldFormatting(array('Title' => '<a href=\\"admin/show/$ID\\">$Title</a>', 'AbsoluteLink' => '<a href=\\"$value\\">$value</a>'));
         $dependentTable->setPermissions(array('show', 'export'));
     }
     // Lay out the fields
     $fields = new FieldSet($rootTab = new TabSet("Root", $tabContent = new TabSet('Content', $tabMain = new Tab('Main', new TextField("Title", $this->fieldLabel('Title')), new TextField("MenuTitle", $this->fieldLabel('MenuTitle')), new HtmlEditorField("Content", _t('SiteTree.HTMLEDITORTITLE', "Content", PR_MEDIUM, 'HTML editor title'))), $tabMeta = new Tab('Metadata', new FieldGroup(_t('SiteTree.URL', "URL"), new LabelField('BaseUrlLabel', Controller::join_links(Director::absoluteBaseURL(), self::nested_urls() && $this->ParentID ? $this->Parent()->RelativeLink(true) : null)), new UniqueRestrictedTextField("URLSegment", "URLSegment", "SiteTree", _t('SiteTree.VALIDATIONURLSEGMENT1', "Another page is using that URL. URL must be unique for each page"), "[^A-Za-z0-9-]+", "-", _t('SiteTree.VALIDATIONURLSEGMENT2', "URLs can only be made up of letters, digits and hyphens."), "", "", "", 50), new LabelField('TrailingSlashLabel', "/")), new LiteralField('LinkChangeNote', self::nested_urls() && count($this->Children()) ? '<p>' . $this->fieldLabel('LinkChangeNote') . '</p>' : null), new HeaderField('MetaTagsHeader', $this->fieldLabel('MetaTagsHeader')), new TextField("MetaTitle", $this->fieldLabel('MetaTitle')), new TextareaField("MetaKeywords", $this->fieldLabel('MetaKeywords'), 1), new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')), new TextareaField("ExtraMeta", $this->fieldLabel('ExtraMeta')))), $tabBehaviour = new Tab('Behaviour', new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getClassDropdown()), new OptionsetField("ParentType", _t("SiteTree.PAGELOCATION", "Page location"), array("root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page (choose below)"))), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree'), new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')), new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch')), new CheckboxField("ProvideComments", $this->fieldLabel('ProvideComments')), new LiteralField("HomepageForDomainInfo", "<p>" . _t('SiteTree.NOTEUSEASHOMEPAGE', "Use this page as the 'home page' for the following domains: \n\t\t\t\t\t\t\t(separate multiple domains with commas)") . "</p>"), new TextField("HomepageForDomain", _t('SiteTree.HOMEPAGEFORDOMAIN', "Domain(s)", PR_MEDIUM, 'Listing domains that should be used as homepage'))), $tabToDo = new Tab(_t('SiteTree.TABTODO', 'To-do') . ($this->ToDo ? '**' : ''), new LiteralField("ToDoHelp", _t('SiteTree.TODOHELP', "<p>You can use this to keep track of work that needs to be done to the content of your site.  To see all your pages with to do information, open the 'Site Reports' window on the left and select 'To Do'</p>")), new TextareaField("ToDo", "", 10)), $tabDependent = new Tab('Dependent', $dependentNote, $dependentTable), $tabAccess = new Tab('Access', new HeaderField('WhoCanViewHeader', _t('SiteTree.ACCESSHEADER', "Who can view this page?"), 2), $viewersOptionsField = new OptionsetField("CanViewType", ""), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", $this->fieldLabel('ViewerGroups')), new HeaderField('WhoCanEditHeader', _t('SiteTree.EDITHEADER', "Who can edit this page?"), 2), $editorsOptionsField = new OptionsetField("CanEditType", ""), $editorGroupsField = new TreeMultiselectField("EditorGroups", $this->fieldLabel('EditorGroups')))));
     /*
      * This filter ensures that the ParentID dropdown selection does not show this node,
      * or its descendents, as this causes vanishing bugs.
      */
     $parentIDField->setFilterFunction(create_function('$node', "return \$node->ID != {$this->ID};"));
     // Conditional dependent pages tab
     if ($dependentPagesCount) {
         $tabDependent->setTitle(_t('SiteTree.TABDEPENDENT', "Dependent pages") . " ({$dependentPagesCount})");
     } else {
         $fields->removeFieldFromTab('Root', 'Dependent');
     }
     // Make page location fields read-only if the user doesn't have the appropriate permission
     if (!Permission::check("SITETREE_REORGANISE")) {
         $fields->makeFieldReadonly('ParentType');
         if ($this->ParentType == 'root') {
             $fields->removeByName('ParentID');
         } else {
             $fields->makeFieldReadonly('ParentID');
         }
     }
     $viewersOptionsSource = array();
     $viewersOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource);
     $editorsOptionsSource = array();
     $editorsOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
     $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
     $editorsOptionsField->setSource($editorsOptionsSource);
     if (!Permission::check('SITETREE_GRANT_ACCESS')) {
         $fields->makeFieldReadonly($viewersOptionsField);
         if ($this->CanViewType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($viewerGroupsField);
//.........這裏部分代碼省略.........
開發者ID:eLBirador,項目名稱:AllAboutCity,代碼行數:101,代碼來源:SiteTree.php

示例7: updateFieldSet

 /**
  * @param FieldSet $fieldset
  * @return false
  */
 function updateFieldSet(&$fieldset)
 {
     // Remove, in case it was added beforehand
     $fieldset->removeByName($this->getName());
     return false;
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:10,代碼來源:SecurityToken.php

示例8: updateCMSFields

 function updateCMSFields(FieldSet &$fields)
 {
     $allForums = DataObject::get('Forum');
     $fields->removeByName('ModeratedForums');
     $fields->addFieldToTab('Root.ModeratedForums', new CheckboxSetField('ModeratedForums', _t('ForumRole.MODERATEDFORUMS', 'Moderated forums'), $allForums ? $allForums->map('ID', 'Title') : array()));
     if (Permission::checkMember($this->owner->ID, "ACCESS_FORUM")) {
         $fields->addFieldToTab('Root.Forum', new ImageField("Avatar", _t('ForumRole.UPLOADAVATAR', "Upload avatar")));
         $fields->addFieldToTab('Root.Forum', new DropdownField("ForumRank", _t('ForumRole.FORUMRANK', "User rating"), array("Community Member" => _t('ForumRole.COMMEMBER'), "Administrator" => _t('ForumRole.ADMIN', 'Administrator'), "Moderator" => _t('ForumRole.MOD', 'Moderator'))));
     }
 }
開發者ID:RyeDesigns,項目名稱:silverstripe-forum,代碼行數:10,代碼來源:ForumRole.php

示例9: getSettingsFields

 /**
  * Returns fields related to configuration aspects on this record, e.g. access control.
  * See {@link getCMSFields()} for content-related fields.
  * 
  * @return FieldSet
  */
 function getSettingsFields()
 {
     $fields = new FieldSet($rootTab = new TabSet("Root", $tabBehaviour = new Tab('Settings', new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getClassDropdown()), new OptionsetField("ParentType", _t("SiteTree.PAGELOCATION", "Page location"), array("root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page (choose below)"))), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree', 'ID', 'MenuTitle'), new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')), new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch')), new LiteralField("HomepageForDomainInfo", "<p>" . _t('SiteTree.NOTEUSEASHOMEPAGE', "Use this page as the 'home page' for the following domains: \n\t\t\t\t\t\t\t(separate multiple domains with commas)") . "</p>"), new TextField("HomepageForDomain", _t('SiteTree.HOMEPAGEFORDOMAIN', "Domain(s)", PR_MEDIUM, 'Listing domains that should be used as homepage'))), $tabAccess = new Tab('Access', $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteTree.ACCESSHEADER', "Who can view this page?")), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", $this->fieldLabel('ViewerGroups')), $editorsOptionsField = new OptionsetField("CanEditType", _t('SiteTree.EDITHEADER', "Who can edit this page?")), $editorGroupsField = new TreeMultiselectField("EditorGroups", $this->fieldLabel('EditorGroups')))));
     /*
      * This filter ensures that the ParentID dropdown selection does not show this node,
      * or its descendents, as this causes vanishing bugs.
      */
     $parentIDField->setFilterFunction(create_function('$node', "return \$node->ID != {$this->ID};"));
     $tabBehaviour->setTitle(_t('SiteTree.TABBEHAVIOUR', "Behavior"));
     $tabAccess->setTitle(_t('SiteTree.TABACCESS', "Access"));
     // Make page location fields read-only if the user doesn't have the appropriate permission
     if (!Permission::check("SITETREE_REORGANISE")) {
         $fields->makeFieldReadonly('ParentType');
         if ($this->ParentType == 'root') {
             $fields->removeByName('ParentID');
         } else {
             $fields->makeFieldReadonly('ParentID');
         }
     }
     $viewersOptionsSource = array();
     $viewersOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource);
     $editorsOptionsSource = array();
     $editorsOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
     $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
     $editorsOptionsField->setSource($editorsOptionsSource);
     if (!Permission::check('SITETREE_GRANT_ACCESS')) {
         $fields->makeFieldReadonly($viewersOptionsField);
         if ($this->CanViewType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($viewerGroupsField);
         } else {
             $fields->removeByName('ViewerGroups');
         }
         $fields->makeFieldReadonly($editorsOptionsField);
         if ($this->CanEditType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($editorGroupsField);
         } else {
             $fields->removeByName('EditorGroups');
         }
     }
     if (self::$runCMSFieldsExtensions) {
         $this->extend('updateSettingsFields', $fields);
     }
     return $fields;
 }
開發者ID:rixrix,項目名稱:silverstripe-cms,代碼行數:55,代碼來源:SiteTree.php

示例10: updateCMSFields

 public function updateCMSFields(FieldSet $fields)
 {
     $fields->removeByName('Hash');
     $fields->replaceField('ViewedMembers', $members = new TableListField('ViewedMembers', 'Member', array('Name' => 'Name', 'Email' => 'Email'), '"Newsletter_TrackedLinkID" = ' . $this->owner->ID, null, 'LEFT JOIN "Newsletter_TrackedLink_ViewedMembers" ON "MemberID" = "Member"."ID"'));
     $members->setPermissions(array('show'));
 }
開發者ID:nyeholt,項目名稱:silverstripe-newsletter-tracking,代碼行數:6,代碼來源:NewsletterTrackedLinkTrackingExtension.php

示例11: removeFilterField

 public function removeFilterField($name)
 {
     parent::removeByName($name);
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:4,代碼來源:CalendarFilterFieldSet.php

示例12: updateCMSFields

 function updateCMSFields(FieldSet &$fields)
 {
     $fields->removeByName('GUID');
 }
開發者ID:helpfulrobot,項目名稱:sunnysideup-ecommerce-unleashed,代碼行數:4,代碼來源:UnleashedObjectDOD.php

示例13: updateCMSFields

 /**
  * Update the CMS fields specifically for Member
  * decorated by this NewsletterRole decorator.
  * 
  * @param FieldSet $fields CMS fields to update
  */
 function updateCMSFields($fields)
 {
     $fields->removeByName('UnsubscribedRecords');
     $fields->removeByName('BlacklistedEmail');
 }
開發者ID:nyeholt,項目名稱:silverstripe-newsletter,代碼行數:11,代碼來源:NewsletterRole.php

示例14: removePseudoRelationsFromFieldSet

	/**
	 * Remove scaffolded fields for pseudo has_many/has_one
	 * relations added by Janitor from the given FieldSet.
	 * 
	 * @param FieldSet $fields
	 */
	private function removePseudoRelationsFromFieldSet(FieldSet& $fields) {
		$dataFields = $fields->dataFields();
		if ($dataFields) foreach ($dataFields as $field) {
			if (preg_match('/^__/', $field->Name()))
				$fields->removeByName($field->Name());
		}
	}
開發者ID:redema,項目名稱:silverstripe-janitor,代碼行數:13,代碼來源:DataObjectOnDeleteDecorator.php

示例15: DetailForm

 function DetailForm()
 {
     $ID = isset($_REQUEST['ctf']['ID']) ? Convert::raw2xml($_REQUEST['ctf']['ID']) : null;
     $childID = isset($_REQUEST['ctf']['childID']) ? Convert::raw2xml($_REQUEST['ctf']['childID']) : null;
     $childClass = isset($_REQUEST['fieldName']) ? Convert::raw2xml($_REQUEST['fieldName']) : null;
     $methodName = isset($_REQUEST['methodName']) ? $_REQUEST['methodName'] : null;
     if (!$childID) {
         user_error("AssetTableField::DetailForm Please specify a valid ID");
         return null;
     }
     if ($childID) {
         $childData = DataObject::get_by_id("File", $childID);
     }
     if (!$childData) {
         user_error("AssetTableField::DetailForm No record found");
         return null;
     }
     if ($childData->ParentID) {
         $folder = DataObject::get_by_id('File', $childData->ParentID);
     } else {
         $folder = singleton('Folder');
     }
     $urlLink = "<div class='field readonly'>";
     $urlLink .= "<label class='left'>" . _t('AssetTableField.URL', 'URL') . "</label>";
     $urlLink .= "<span class='readonly'><a href='{$childData->Link()}'>{$childData->RelativeLink()}</a></span>";
     $urlLink .= "</div>";
     $detailFormFields = new FieldSet(new TabSet("BottomRoot", new Tab(_t('AssetTableField.MAIN', 'Main'), new TextField("Title", _t('AssetTableField.TITLE', 'Title')), new TextField("Name", _t('AssetTableField.FILENAME', 'Filename')), new LiteralField("AbsoluteURL", $urlLink), new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'Type')), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'Size'), $childData->getSize()), new DropdownField("OwnerID", _t('AssetTableField.OWNER', 'Owner'), Member::mapInCMSGroups($folder->CanEdit())), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded')), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed')))));
     if (is_a($childData, 'Image')) {
         $big = $childData->URL;
         $thumbnail = $childData->getFormattedImage('AssetLibraryPreview')->URL;
         // Hmm this required the translated string to be appended to BottomRoot to add this to the Main tab
         $detailFormFields->addFieldToTab("BottomRoot." . _t('AssetTableField.MAIN', 'Main'), new ReadonlyField("Dimensions", _t('AssetTableField.DIM', 'Dimensions')), "Created");
         $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.IMAGE', 'Image'), new LiteralField("ImageFull", '<a id="ImageEditorActivator" href="javascript: void(0)">' . "<img id='thumbnailImage' src='{$thumbnail}?r=" . rand(1, 100000) . "' alt='{$childData->Name}' /><p>" . _t('AssetTableField.EDITIMAGE', 'Edit this image') . "</p>" . '</a>' . '<script type="text/javascript" src="cms/javascript/ImageEditor/Activator.js"></script><script type="text/javascript">var imageActivator = new ImageEditor.Activator.initialize();Event.observe("ImageEditorActivator","click",imageActivator.onOpen);</script>')), 'Main');
         if (class_exists('GalleryFile')) {
             $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField("Content", _t('AssetTableField.CAPTION', 'Caption'))));
         }
     } else {
         if (class_exists('GalleryFile')) {
             if ($childData->Extension == 'swf') {
                 $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField("Content", _t('AssetTableField.CAPTION', 'Caption')), new TextField('PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width')), new TextField('PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height')), new HeaderField(_t('AssetTableField.SWFFILEOPTIONS', 'SWF File Options')), new CheckboxField('Embed', _t('AssetTableField.ISFLASH', 'Is A Flash Document')), new CheckboxField('LimitDimensions', _t('AssetTableField.DIMLIMT', 'Limit The Dimensions In The Popup Window'))));
             } else {
                 $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField("Content", _t('AssetTableField.CAPTION', 'Caption')), new TextField('PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width')), new TextField('PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height'))));
             }
         }
     }
     if ($childData && $childData->hasMethod('BackLinkTracking')) {
         $links = $childData->BackLinkTracking();
         if ($links->exists()) {
             foreach ($links as $link) {
                 $backlinks[] = "<li><a href=\"admin/show/{$link->ID}\">" . $link->Breadcrumbs(null, true) . "</a></li>";
             }
             $backlinks = "<div style=\"clear:left\">" . _t('AssetTableField.PAGESLINKING', 'The following pages link to this file:') . "<ul>" . implode("", $backlinks) . "</ul>";
         }
         if (!isset($backlinks)) {
             $backlinks = "<p>" . _t('AssetTableField.NOLINKS', "This file hasn't been linked to from any pages.") . "</p>";
         }
         $detailFormFields->addFieldToTab("BottomRoot.Links", new LiteralField("Backlinks", $backlinks));
     }
     // the ID field confuses the Controller-logic in finding the right view for ReferencedField
     $detailFormFields->removeByName('ID');
     if ($childData) {
         $childData->extend('updateCMSFields', $detailFormFields);
     }
     // add a namespaced ID instead thats "converted" by saveComplexTableField()
     $detailFormFields->push(new HiddenField("ctf[childID]", "", $childID));
     $detailFormFields->push(new HiddenField("ctf[ClassName]", "", $this->sourceClass));
     $readonly = $this->methodName == "show";
     $form = new ComplexTableField_Popup($this, "DetailForm", $detailFormFields, $this->sourceClass, $readonly);
     if (is_numeric($childID)) {
         if ($methodName == "show" || $methodName == "edit") {
             $form->loadDataFrom($childData);
         }
     }
     if (!$folder->userCanEdit() || $methodName == "show") {
         $form->makeReadonly();
     }
     return $form;
 }
開發者ID:ramziammar,項目名稱:websites,代碼行數:78,代碼來源:AssetTableField.php


注:本文中的FieldSet::removeByName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。