public function getCMSFields($params = null) { //fields that shouldn't be changed once coupon is used $fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints"))))); if (!$this->isInDB()) { $fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints"); } if ($count = $this->getUseCount()) { $fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton")))); } if ($params && isset($params['forcetype'])) { $valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield; $fields->insertAfter($valuefield, "Type"); $fields->makeFieldReadonly("Type"); } else { if ($this->Type && (double) $this->{$this->Type}) { $valuefield = $this->Type == "Percent" ? $percentfield : $amountfield; $fields->makeFieldReadonly("Type"); $fields->insertAfter($valuefield, "ActionTitle"); $fields->replaceField($this->Type, $valuefield->performReadonlyTransformation()); if ($this->Type == "Percent") { $fields->insertAfter($maxamountfield, "Percent"); } } } $this->extend("updateCMSFields", $fields, $params); return $fields; }
public function updateCMSFields(FieldList $fields) { if ($fields->getField('FacebookUID')) { $fields->makeFieldReadonly('FacebookUID'); $fields->makeFieldReadonly('FacebookLink'); $fields->makeFieldReadonly('FacebookTimezone'); } }
public function getCMSFields() { $conf = SiteConfig::current_site_config(); $themes = $conf->getAvailableThemes(); $theme = new DropdownField('Theme', _t('Multisites.THEME', 'Theme'), $themes); $theme->setEmptyString(_t('Multisites.DEFAULTTHEME', '(Default theme)')); $fields = new FieldList(new TabSet('Root', new Tab('Main', new HeaderField('SiteConfHeader', _t('Multisites.SITECONF', 'Site Configuration')), new TextField('Title', _t('Multisites.TITLE', 'Title')), new TextField('Tagline', _t('Multisites.TAGLINE', 'Tagline/Slogan')), $theme, new HeaderField('SiteURLHeader', _t('Multisites.SITEURL', 'Site URL')), new OptionsetField('Scheme', _t('Multisites.SCHEME', 'Scheme'), array('any' => _t('Multisites.ANY', 'Any'), 'http' => _t('Multisites.HTTP', 'HTTP'), 'https' => _t('Multisites.HTTPS', 'HTTPS (HTTP Secure)'))), new TextField('Host', _t('Multisites.HOST', 'Host')), new MultiValueTextField('HostAliases', _t('Multisites.HOSTALIASES', 'Host Aliases')), new CheckboxField('IsDefault', _t('Multisites.ISDEFAULT', 'Is this the default site?')), new HeaderField('SiteAdvancedHeader', _t('Multisites.SiteAdvancedHeader', 'Advanced Settings')), TextareaField::create('RobotsTxt', _t('Multisites.ROBOTSTXT', 'Robots.txt'))->setDescription(_t('Multisites.ROBOTSTXTUSAGE', '<p>Please consult <a href="http://www.robotstxt.org/robotstxt.html" target="_blank">http://www.robotstxt.org/robotstxt.html</a> for usage of the robots.txt file.</p>'))))); $devIDs = Config::inst()->get('Multisites', 'developer_identifiers'); if (is_array($devIDs)) { if (!ArrayLib::is_associative($devIDs)) { $devIDs = ArrayLib::valuekey($devIDs); } $fields->addFieldToTab('Root.Main', DropdownField::create('DevID', _t('Multisites.DeveloperIdentifier', 'Developer Identifier'), $devIDs)); } if (Multisites::inst()->assetsSubfolderPerSite()) { $fields->addFieldToTab('Root.Main', new TreeDropdownField('FolderID', _t('Multisites.ASSETSFOLDER', 'Assets Folder'), 'Folder'), 'SiteURLHeader'); } if (!Permission::check('SITE_EDIT_CONFIGURATION')) { foreach ($fields->dataFields() as $field) { $fields->makeFieldReadonly($field); } } $this->extend('updateSiteCMSFields', $fields); return $fields; }
public function updateCMSFields(\FieldList $fields) { if (!$this->owner->Deleted) { $fields->removeByName('Deleted'); $fields->removeByName('DeletedByID'); } else { $Deleted = $fields->dataFieldByName('Deleted'); $DeletedByID = $fields->dataFieldByName('DeletedByID'); if ($Deleted) { $fields->makeFieldReadonly('Deleted'); } if ($DeletedByID) { $fields->makeFieldReadonly('DeletedByID'); } } }
public function updateCMSFields(FieldList $fields) { $fields->addFieldsToTab("Root.AdditionalSettings", array(TextField::create('SubSiteConstant', 'Subsite Constant')->setAttribute('placeholder', 'SUBSITE_NAME')->setDescription('Used as a guarantee for module loading. <a href="https://gitlab.cwp.govt.nz/modules/subsite-config/wikis/SubSiteConfig" target="_blank">Details here</a>'))); // Make sure only a developer can change this value if (!Permission::check('SUBSITE_DEVELOPER_EDIT')) { $fields->makeFieldReadonly('SubSiteConstant'); } return $fields; }
/** * Get the fields that are sent to the CMS. In * your extensions: updateCMSFields($fields) * * @return FieldList */ public function getCMSFields() { $groupsMap = array(); foreach (Group::get() as $group) { // Listboxfield values are escaped, use ASCII char instead of » $groupsMap[$group->ID] = $group->getBreadcrumbs(' > '); } asort($groupsMap); $fields = new FieldList(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")))), new HiddenField('ID')); if (!Permission::check('EDIT_SITECONFIG')) { $fields->makeFieldReadonly($taglineField); $fields->makeFieldReadonly($titleField); } if (file_exists(BASE_PATH . '/install.php')) { $fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", "<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", "Warning: You should remove install.php from this SilverStripe install for security reasons.") . "</p>"), "Title"); } $tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main")); $this->extend('updateCMSFields', $fields); return $fields; }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { if ($this->owner->Identifier == '') { $fields->removeByName('Identifier'); } else { $fields->makeFieldReadonly('Identifier'); } $fields->removeByName('Images'); $fields->addFieldToTab('Root.Images', new UploadField('Images', 'Images', $this->owner->Images())); $fields->removeByName('Files'); $fields->addFieldToTab('Root.Files', new UploadField('Files', 'Files', $this->owner->Files())); }
public function updateCMSFields(FieldList $fields) { if ($this->owner->ID != 0) { $domains = $this->owner->Domains()->map('ID', 'Domain'); if (Director::isDev() || Director::isTest()) { if (defined('DEV_SUBSITE_' . $this->owner->ID)) { $subsiteurl = 'DEV_SUBSITE_' . $this->owner->ID; $wardingfield = LiteralField::create("WarningDomain", "<p class=\"message warning\">While running in dev or test mode," . " the current domain will be used: <strong>" . constant($subsiteurl) . "</strong></p>"); $fields->addFieldToTab("Root.DomainEnvironments", $wardingfield); } } $fields->addFieldToTab('Root.DomainEnvironments', TextField::create('Live', 'Live', $this->owner->domain())->setReadonly(true)); $fields->addFieldToTab('Root.DomainEnvironments', DropdownField::create('TestDomainID', 'Test', $domains)); $fields->addFieldToTab('Root.DomainEnvironments', DropdownField::create('DevDomainID', 'Dev', $domains)); $fields->makeFieldReadonly('Live'); } }
/** * Get the fields that are sent to the CMS. In * your extensions: updateCMSFields($fields) * * @return FieldList */ function getCMSFields() { Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js"); $groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray(); asort($groupsMap); $fields = new FieldList(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")), $themeDropdownField = new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemes())), $tabAccess = new Tab('Access', $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?")), $viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap), $editorsOptionsField = new OptionsetField("CanEditType", _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?")), $editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))->setMultiple(true)->setSource($groupsMap), $topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType", _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?")), $topLevelCreatorsGroupsField = ListboxField::create("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))->setMultiple(true)->setSource($groupsMap)))); $themeDropdownField->setEmptyString(_t('SiteConfig.DEFAULTTHEME', '(Use default theme)')); $viewersOptionsSource = array(); $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["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); $topLevelCreatorsOptionsField->setSource($editorsOptionsSource); // Translatable doesn't handle updateCMSFields on DataObjects, // so add it here to save the current Locale, // because onBeforeWrite does not work. if (class_exists('Translatable') && Object::has_extension('SiteConfig', "Translatable")) { $fields->push(new HiddenField("Locale")); } if (!Permission::check('EDIT_SITECONFIG')) { $fields->makeFieldReadonly($viewersOptionsField); $fields->makeFieldReadonly($viewerGroupsField); $fields->makeFieldReadonly($editorsOptionsField); $fields->makeFieldReadonly($editorGroupsField); $fields->makeFieldReadonly($topLevelCreatorsOptionsField); $fields->makeFieldReadonly($topLevelCreatorsGroupsField); $fields->makeFieldReadonly($taglineField); $fields->makeFieldReadonly($titleField); } if (file_exists(BASE_PATH . '/install.php')) { $fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", "<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", "Warning: You should remove install.php from this SilverStripe install for security reasons.") . "</p>"), "Title"); } $tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main")); $tabAccess->setTitle(_t('SiteConfig.TABACCESS', "Access")); $this->extend('updateCMSFields', $fields); return $fields; }
/** * Get the fields that are sent to the CMS. In * your extensions: updateCMSFields($fields) * * @return FieldList */ public function getCMSFields() { $groupsMap = array(); foreach (Group::get() as $group) { // Listboxfield values are escaped, use ASCII char instead of » $groupsMap[$group->ID] = $group->getBreadcrumbs(' > '); } asort($groupsMap); $fields = new FieldList(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")), $themeDropdownField = new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemes())), $tabAccess = new Tab('Access', $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?")), $viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group')), $editorsOptionsField = new OptionsetField("CanEditType", _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?")), $editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group')), $topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType", _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?")), $topLevelCreatorsGroupsField = ListboxField::create("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group')))), new HiddenField('ID')); $themeDropdownField->setEmptyString(_t('SiteConfig.DEFAULTTHEME', '(Use default theme)')); $viewersOptionsSource = array(); $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["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); $topLevelCreatorsOptionsField->setSource($editorsOptionsSource); if (!Permission::check('EDIT_SITECONFIG')) { $fields->makeFieldReadonly($viewersOptionsField); $fields->makeFieldReadonly($viewerGroupsField); $fields->makeFieldReadonly($editorsOptionsField); $fields->makeFieldReadonly($editorGroupsField); $fields->makeFieldReadonly($topLevelCreatorsOptionsField); $fields->makeFieldReadonly($topLevelCreatorsGroupsField); $fields->makeFieldReadonly($taglineField); $fields->makeFieldReadonly($titleField); } if (file_exists(BASE_PATH . '/install.php')) { $fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", "<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", "Warning: You should remove install.php from this SilverStripe install for security reasons.") . "</p>"), "Title"); } $tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main")); $tabAccess->setTitle(_t('SiteConfig.TABACCESS', "Access")); $this->extend('updateCMSFields', $fields); return $fields; }
public function updateCMSFields(FieldList $fields) { $fields->makeFieldReadonly('VkUID'); $fields->makeFieldReadonly('VkLink'); $fields->makeFieldReadonly('VkTimezone'); }
public function updateSettingsFields(\FieldList $fields) { // $controller, $name, $sourceClass, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "" $fieldPerms = $this->fieldPermissions(); // first, make a field readonly if there's no permission to edit it foreach ($fieldPerms as $fieldId => $permission) { if (!$this->checkPerm($permission)) { // convert to a readonly field $hasField = $fields->dataFieldByName($fieldId); if ($hasField) { $fields->makeFieldReadonly($fieldId); } } } if ($this->owner->checkPerm('ViewPermissions')) { $listField = null; if ($this->owner->ID) { $accessList = DataList::create('AccessAuthority')->filter(array('ItemID' => $this->owner->ID, 'ItemType' => $this->owner->class)); $listField = GridField::create('AccessAuthority', false, $accessList, $fieldConfig = GridFieldConfig_RecordEditor::create(20)); $fieldConfig->removeComponentsByType('GridFieldEditButton'); // AccessAuthorityGridFieldDetailForm_ItemRequest $detailForm = $fieldConfig->getComponentByType('GridFieldDetailForm'); $detailForm->setItemRequestClass('AccessAuthorityGridFieldDetailForm_ItemRequest'); $listField->forObject = $this->owner; } $perms = array('show'); $rootTab = $fields->fieldByName('Root'); $fileRootTab = $fields->fieldByName('BottomRoot'); $addTo = null; if ($rootTab) { $addTo = $fields->findOrMakeTab('Root.Permissions'); } else { if ($fileRootTab) { $addTo = $fields->findOrMakeTab('BottomRoot.Permissions'); } } // only add if we have a CMS backend! if ($addTo) { if ($this->owner->checkPerm('ChangePermissions')) { $perms[] = 'add'; $addTo->push(new CheckboxField('InheritPerms', _t('Restrictable.INHERIT_PERMS', 'Inherit Permissions'))); $addTo->push(new CheckboxField('PublicAccess', _t('Restrictable.PUBLIC_ACCESS', 'Publicly Accessible'))); } if ($this->checkPerm('TakeOwnership')) { $df = DropdownField::create('OwnerID', _t('Restrictable.OWNER', 'Owner'), DataObject::get('Member')->map('ID', 'Title')); $df->setEmptyString(_t('RestrictedObjects.CHOOSE_NEW_OWNER', '(choose a new owner)')); $addTo->push($df); } if ($this->owner->checkPerm('DeletePermissions')) { $perms[] = 'delete'; } if ($listField) { $addTo->push($listField); } } } }
public function testMakeFieldReadonly() { $FieldList = new FieldList(new TabSet('Root', new Tab('Main', new TextField('A'), new TextField('B')))); $FieldList->makeFieldReadonly('A'); $this->assertTrue($FieldList->dataFieldByName('A')->isReadonly(), 'Field nested inside a TabSet and FieldList can be marked readonly by FieldList->makeFieldReadonly()'); }
/** * Returns fields related to configuration aspects on this record, e.g. access control. See {@link getCMSFields()} * for content-related fields. * * @return FieldList */ public function getSettingsFields() { $groupsMap = array(); foreach (Group::get() as $group) { // Listboxfield values are escaped, use ASCII char instead of » $groupsMap[$group->ID] = $group->getBreadcrumbs(' > '); } asort($groupsMap); $fields = new FieldList($rootTab = new TabSet("Root", $tabBehaviour = new Tab('Settings', new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getClassDropdown()), $parentTypeSelector = new CompositeField(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"))), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree', 'ID', 'MenuTitle')), $visibility = new FieldGroup(new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')), new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch'))), $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteTree.ACCESSHEADER', "Who can view this page?")), $viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group')), $editorsOptionsField = new OptionsetField("CanEditType", _t('SiteTree.EDITHEADER', "Who can edit this page?")), $editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group'))))); $visibility->setTitle($this->fieldLabel('Visibility')); // 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};")); $parentTypeSelector->addExtraClass('parentTypeSelector'); $tabBehaviour->setTitle(_t('SiteTree.TABBEHAVIOUR', "Behavior")); // 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; }