本文整理汇总了PHP中FieldList::findOrMakeTab方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::findOrMakeTab方法的具体用法?PHP FieldList::findOrMakeTab怎么用?PHP FieldList::findOrMakeTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::findOrMakeTab方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
/** =========================================
* @var TextareaField $address
* @var TextareaField $postalAddress
* @var TextField $mailChimpAPI
* @var TextareaField $mailChimpSuccessMessage
===========================================*/
if (!$fields->fieldByName('Root.Settings')) {
$fields->addFieldToTab('Root', TabSet::create('Settings'));
}
/** -----------------------------------------
* Details
* ----------------------------------------*/
$address = TextareaField::create('Address', 'Address');
$address->setRows(8);
$postalAddress = TextareaField::create('PostalAddress', 'Postal Address');
$postalAddress->setRows(8);
$fields->findOrMakeTab('Root.Settings.Details');
$fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('', 'Company Details'), Textfield::create('Phone', 'Phone Number'), Textfield::create('Email', 'Public Email Address'), $address, $postalAddress, TextField::create('Facebook', 'Facebook'), TextField::create('LinkedIn', 'LinkedIn'), TextField::create('Pinterest', 'Pinterest'), TextField::create('TwitterHandle', 'Twitter Handle')));
/** -----------------------------------------
* Subscription
* ----------------------------------------*/
$mailChimpAPI = TextField::create('MailChimpAPI', 'API Key');
$mailChimpSuccessMessage = TextareaField::create('MailChimpSuccessMessage', 'Success Message (optional)');
$mailChimpAPI->setRightTitle('<a href="https://us9.admin.mailchimp.com/account/api-key-popup/" target="_blank"><i>How do I get my MailChimp API Key?</i></a>');
$mailChimpSuccessMessage->setRows(2)->setRightTitle('Message displayed when a user has successfully subscribed to a list.');
$fields->findOrMakeTab('Root.Settings.Subscription', 'Subscription');
$fields->addFieldsToTab('Root.Settings.Subscription', array(HeaderField::create('', 'Newsletter Subscription'), LiteralField::create('', '<p>The API key, and list ID are necessary for the Newsletter Subscription form to function.</p>'), $mailChimpAPI, TextField::create('MailChimpListID', 'List ID'), $mailChimpSuccessMessage));
}
示例2: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
/* -----------------------------------------
* Color Picker
------------------------------------------*/
Requirements::css('boilerplate/css/colorpicker.css');
Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
/* =========================================
* Settings
=========================================*/
if (!$fields->fieldByName('Root.Settings')) {
$fields->addFieldToTab('Root', new TabSet('Settings'));
}
/* -----------------------------------------
* Images
------------------------------------------*/
$fields->findOrMakeTab('Root.Settings.Images', 'Images');
$fields->addFieldsToTab('Root.Settings.Images', array($logo = new UploadField('LogoImage', _t('BoilerplateConfig.LogoImageLabel', 'Logo')), $favicon = new UploadField('Favicon', _t('BoilerplateConfig.FaviconLabel', 'Favicon'))));
$logo->setRightTitle('Choose an Image For Your Logo');
$favicon->setRightTitle('Choose an Image For Your Favicon (16x16)');
/* -----------------------------------------
* Company Details
------------------------------------------*/
$fields->findOrMakeTab('Root.Settings.Details', 'Details');
$fields->addFieldsToTab('Root.Settings.Details', array(new Textfield('Phone', _t('BoilerplateConfig.PhoneLabel', 'Phone Number')), new Textfield('Email', _t('BoilerplateConfig.EmailLabel', 'Public Email Address')), $PhysicalAddress = new HtmlEditorField('PhysicalAddress', _t('BoilerplateConfig.PhysicalAddressLabel', 'Physical Address'))));
$PhysicalAddress->setRows(3);
/* -----------------------------------------
* Tracking Code
------------------------------------------*/
$fields->findOrMakeTab('Root.Settings.TrackingCode', 'Tracking Code');
$fields->addFieldsToTab('Root.Settings.TrackingCode', array($trackingCode = new TextareaField('TrackingCode', _t('BoilerplateConfig.TrackingCodeLabel', 'Tracking Code'))));
$trackingCode->setRows(20);
}
示例3: updateCMSFields
/**
* Updates the CMS fields of the extended object.
*
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
// Create Moderno Tab Set:
$fields->addFieldToTab('Root', TabSet::create('Moderno', _t('ModernoConfigExtension.MODERNO', 'Moderno')));
// Create Colors Tab:
$fields->findOrMakeTab('Root.Moderno.Colors', _t('ModernoConfigExtension.COLORS', 'Colors'));
// Create Colors Fields:
$fields->addFieldsToTab('Root.Moderno.Colors', array(ColorField::create('ModernoHighlightColor', _t('ModernoConfigExtension.HIGHLIGHTCOLOR', 'Highlight color')), ColorField::create('ModernoLogoBkgColor', _t('ModernoConfigExtension.LOGOBACKGROUNDCOLOR', 'Logo background color')), ColorField::create('ModernoLinkColor', _t('ModernoConfigExtension.LINKCOLOR', 'Link color')), ColorField::create('ModernoProfileLinkColor', _t('ModernoConfigExtension.PROFILELINKCOLOR', 'Profile link color'))));
// Create Branding Tab:
$fields->findOrMakeTab('Root.Moderno.Branding', _t('ModernoConfigExtension.BRANDING', 'Branding'));
// Create Branding Fields:
$fields->addFieldsToTab('Root.Moderno.Branding', array(TextField::create('ModernoApplicationName', _t('ModernoConfigExtension.APPLICATIONNAME', 'Application name')), TextField::create('ModernoApplicationLink', _t('ModernoConfigExtension.APPLICATIONLINK', 'Application link')), ToggleCompositeField::create('ModernoLogoToggle', _t('ModernoConfigExtension.LOGOIMAGETOGGLETITLE', 'Logo Image'), array(UploadField::create('ModernoLogoImage', _t('ModernoConfigExtension.LOGOIMAGE', 'Logo image'))->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()), FieldGroup::create(_t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'), array(TextField::create('ModernoLogoImageWidth', '')->setAttribute('placeholder', _t('ModernoConfigExtension.WIDTH', 'Width')), LiteralField::create('ModernoLogoImageBy', '<i class="fa fa-times by"></i>'), TextField::create('ModernoLogoImageHeight', '')->setAttribute('placeholder', _t('ModernoConfigExtension.HEIGHT', 'Height')))), DropdownField::create('ModernoLogoImageResize', _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'), self::get_resize_methods())->setEmptyString(' '), CheckboxField::create('ModernoHideSiteName', _t('ModernoConfigExtension.HIDESITENAME', 'Hide site name')), CheckboxField::create('ModernoSupportRetina', _t('ModernoConfigExtension.SUPPORTRETINADEVICES', 'Support Retina devices')))), ToggleCompositeField::create('ModernoLoadingToggle', _t('ModernoConfigExtension.LOADINGIMAGETOGGLETITLE', 'Loading Image'), array(UploadField::create('ModernoLoadingImage', _t('ModernoConfigExtension.LOADINGIMAGE', 'Loading image'))->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()), FieldGroup::create(_t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'), array(TextField::create('ModernoLoadingImageWidth', '')->setAttribute('placeholder', _t('ModernoConfigExtension.WIDTH', 'Width')), LiteralField::create('ModernoLoadingImageBy', '<i class="fa fa-times by"></i>'), TextField::create('ModernoLoadingImageHeight', '')->setAttribute('placeholder', _t('ModernoConfigExtension.HEIGHT', 'Height')))), DropdownField::create('ModernoLoadingImageResize', _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'), self::get_resize_methods())->setEmptyString(' ')))));
}
示例4: getEditForm
public function getEditForm($id = null, $fields = null)
{
// TODO Duplicate record fetching (see parent implementation)
if (!$id) {
$id = $this->currentPageID();
}
$form = parent::getEditForm($id);
// TODO Duplicate record fetching (see parent implementation)
$record = $this->getRecord($id);
if ($record && !$record->canView()) {
return Security::permissionFailure($this);
}
$memberList = GridField::create('Members', false, Member::get(), $memberListConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldButtonRow('after'))->addComponent(new GridFieldExportButton('buttons-after-left')))->addExtraClass("members_grid");
if ($record && method_exists($record, 'getValidator')) {
$validator = $record->getValidator();
} else {
$validator = Injector::inst()->get('Member')->getValidator();
}
$memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator($validator);
$groupList = GridField::create('Groups', false, Group::get(), GridFieldConfig_RecordEditor::create());
$columns = $groupList->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array('Breadcrumbs' => singleton('Group')->fieldLabel('Title')));
$columns->setFieldFormatting(array('Breadcrumbs' => function ($val, $item) {
return Convert::raw2xml($item->getBreadcrumbs(' > '));
}));
$fields = new FieldList($root = new TabSet('Root', $usersTab = new Tab('Users', _t('SecurityAdmin.Users', 'Users'), $memberList, new LiteralField('MembersCautionText', sprintf('<p class="caution-remove"><strong>%s</strong></p>', _t('SecurityAdmin.MemberListCaution', 'Caution: Removing members from this list will remove them from all groups and the' . ' database')))), $groupsTab = new Tab('Groups', singleton('Group')->i18n_plural_name(), $groupList)), new HiddenField('ID', false, 0));
// Add import capabilities. Limit to admin since the import logic can affect assigned permissions
if (Permission::check('ADMIN')) {
$fields->addFieldsToTab('Root.Users', array(new HeaderField(_t('SecurityAdmin.IMPORTUSERS', 'Import users'), 3), new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('memberimport')))));
$fields->addFieldsToTab('Root.Groups', array(new HeaderField(_t('SecurityAdmin.IMPORTGROUPS', 'Import groups'), 3), new LiteralField('GroupImportFormIframe', sprintf('<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('groupimport')))));
}
// Tab nav in CMS is rendered through separate template
$root->setTemplate('CMSTabSet');
// Add roles editing interface
if (Permission::check('APPLY_ROLES')) {
$rolesField = GridField::create('Roles', false, PermissionRole::get(), GridFieldConfig_RecordEditor::create());
$rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles'));
$rolesTab->push($rolesField);
}
$actionParam = $this->getRequest()->param('Action');
if ($actionParam == 'groups') {
$groupsTab->addExtraClass('ui-state-active');
} elseif ($actionParam == 'users') {
$usersTab->addExtraClass('ui-state-active');
} elseif ($actionParam == 'roles') {
$rolesTab->addExtraClass('ui-state-active');
}
$actions = new FieldList();
$form = Form::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// Tab nav in CMS is rendered through separate template
if ($form->Fields()->hasTabset()) {
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
}
$form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$this->extend('updateEditForm', $form);
return $form;
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = new FieldList(new TabSet('Root'));
$fields->addFieldToTab('Root.Main', new TextField('Title', $this->fieldLabel('Title')));
$filter = '';
$reqParent = isset($_REQUEST['ParentID']) ? (int) $_REQUEST['ParentID'] : 0;
$attachTo = $this->ActionID ? $this->ActionID : $reqParent;
if ($attachTo) {
$action = DataObject::get_by_id('WorkflowAction', $attachTo);
if ($action && $action->ID) {
$filter = '"WorkflowDefID" = ' . (int) $action->WorkflowDefID;
}
}
$actions = DataObject::get('WorkflowAction', $filter);
$options = array();
if ($actions) {
$options = $actions->map();
}
$defaultAction = $action ? $action->ID : "";
$typeOptions = array('Active' => _t('WorkflowTransition.Active', 'Active'), 'Passive' => _t('WorkflowTransition.Passive', 'Passive'));
$fields->addFieldToTab('Root.Main', new DropdownField('ActionID', $this->fieldLabel('ActionID'), $options, $defaultAction));
$fields->addFieldToTab('Root.Main', $nextActionDropdownField = new DropdownField('NextActionID', $this->fieldLabel('NextActionID'), $options));
$nextActionDropdownField->setEmptyString(_t('WorkflowTransition.SELECTONE', '(Select one)'));
$fields->addFieldToTab('Root.Main', new DropdownField('Type', _t('WorkflowTransition.TYPE', 'Type'), $typeOptions));
$members = Member::get();
$fields->findOrMakeTab('Root.RestrictToUsers', _t('WorkflowTransition.TabTitle', 'Restrict to users'));
$fields->addFieldToTab('Root.RestrictToUsers', new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Restrict to Users'), $members));
$fields->addFieldToTab('Root.RestrictToUsers', new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Restrict to Groups'), 'Group'));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例6: updateFields
public function updateFields(FieldList $fields)
{
if (!$this->owner->ID) {
return $fields;
}
$tab = $fields->fieldByName('Root') ? $fields->findOrMakeTab('Root.Workflow') : $fields;
if (Permission::check('APPLY_WORKFLOW')) {
$definition = new DropdownField('WorkflowDefinitionID', _t('WorkflowApplicable.DEFINITION', 'Applied Workflow'));
$definitions = $this->workflowService->getDefinitions()->map()->toArray();
$definition->setSource($definitions);
$definition->setEmptyString(_t('WorkflowApplicable.INHERIT', 'Inherit from parent'));
$tab->push($definition);
// Allow an optional selection of additional workflow definitions.
if ($this->owner->WorkflowDefinitionID) {
$fields->removeByName('AdditionalWorkflowDefinitions');
unset($definitions[$this->owner->WorkflowDefinitionID]);
$tab->push($additional = ListboxField::create('AdditionalWorkflowDefinitions', _t('WorkflowApplicable.ADDITIONAL_WORKFLOW_DEFINITIONS', 'Additional Workflows')));
$additional->setSource($definitions);
$additional->setMultiple(true);
}
}
// Display the effective workflow definition.
if ($effective = $this->getWorkflowInstance()) {
$title = $effective->Definition()->Title;
$tab->push(ReadonlyField::create('EffectiveWorkflow', _t('WorkflowApplicable.EFFECTIVE_WORKFLOW', 'Effective Workflow'), $title));
}
if ($this->owner->ID) {
$config = new GridFieldConfig_Base();
$config->addComponent(new GridFieldEditButton());
$config->addComponent(new GridFieldDetailForm());
$insts = $this->owner->WorkflowInstances();
$log = new GridField('WorkflowLog', _t('WorkflowApplicable.WORKFLOWLOG', 'Workflow Log'), $insts, $config);
$tab->push($log);
}
}
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
/** @var Page|MapaelCountryHolderPageExtension $page */
$page = $this->getOwner();
$tab = $fields->findOrMakeTab('Root.CountryPagesTab', $page->fieldLabel('CountryPages'));
$tab->push(GridField::create('CountryPages', $page->fieldLabel('CountryPages'), $page->CountryPages(), GridFieldConfig_RelationEditor::create()));
}
示例8: buildPageFieldsTab
/**
* Create tab to edit fields values
*
* @param ManyManyList $list
* @param FieldList $fields
*/
public function buildPageFieldsTab(ManyManyList $list, FieldList $fields)
{
$fields->findOrMakeTab('Root.Fields', _t('ConfigurablePage.FIELDS', 'Fields'));
foreach ($list as $editableField) {
// Get the raw form field from the editable version
$field = $editableField->getFormField();
if (!$field) {
continue;
}
// Set the error / formatting messages
$field->setCustomValidationMessage($editableField->getErrorMessage());
// Set the right title on this field
$right = $editableField->getSetting('RightTitle');
if ($right) {
$field->setRightTitle($right);
$field->addExtraClass('help');
}
// Set the required field
if ($editableField->Required) {
$this->requiredFields[] = $editableField->Name;
}
// Set field extra class
if ($editableField->getSetting('ExtraClass')) {
$field->addExtraClass(Convert::raw2att($editableField->getSetting('ExtraClass')));
}
// Set the value
if (!$field instanceof DatalessField) {
$field->value = Convert::raw2att($editableField->Value);
$this->setField($editableField->Name, $editableField->Value);
}
// Add field to tab
$fields->addFieldToTab('Root.Fields', $field);
}
}
示例9: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
Requirements::add_i18n_javascript(ADVANCED_WORKFLOW_DIR . '/javascript/lang');
// Add timepicker functionality
// @see https://github.com/trentrichardson/jQuery-Timepicker-Addon
Requirements::css(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css');
Requirements::css(ADVANCED_WORKFLOW_DIR . '/css/WorkflowCMS.css');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/javascript/WorkflowField.js');
$this->setIsWorkflowInEffect();
$fields->findOrMakeTab('Root.PublishingSchedule', _t('WorkflowEmbargoExpiryExtension.TabTitle', 'Publishing Schedule'));
if ($this->getIsWorkflowInEffect()) {
$fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = Datetimefield::create('DesiredUnPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_UNPUBLISH_DATE', 'Requested un-publish date')), Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date'))->setDisabled(true), Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))->setDisabled(true)));
} else {
$fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))));
}
$dt->getDateField()->setConfig('showcalendar', true);
$ut->getDateField()->setConfig('showcalendar', true);
$dt->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
$ut->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
// Enable a jQuery-UI timepicker widget
if (self::$showTimePicker) {
$dt->getTimeField()->addExtraClass('hasTimePicker');
$ut->getTimeField()->addExtraClass('hasTimePicker');
}
}
示例10: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// Use SortableUploadField instead of UploadField!
$imagesTab = $fields->findOrMakeTab('Root.Images');
$owner = $this->owner;
if ($owner::config()->allow_images) {
$limit = $owner::config()->images_count;
$uploadClass = class_exists("SortableUploadField") && $this->owner->Sorter == "SortOrder" ? "SortableUploadField" : "UploadField";
$imageField = $uploadClass::create('Images');
$imageField->setConfig('allowedMaxFileNumber', $limit);
$imageField->setFolderName('Uploads/' . $this->owner->ClassName . '/' . $this->owner->ID);
if ($limit == 1) {
$imagesTab->setTitle(_t("Object.IMAGETAB", "Images"));
$imageField->setTitle(_t("Object.IMAGEUPLOADLABEL", "Image"));
} else {
$imagesTab->setTitle(_t("Object.IMAGESTAB", "Images"));
$imageField->setTitle(_t("Object.IMAGESUPLOADLABEL", "Images"));
$imageField->setDescription(sprintf(_t("Object.IMAGESUPLOADLIMIT", "Images count limit: %s"), $limit));
if ($this->owner->Sorter == "SortOrder") {
$message = class_exists("SortableUploadField") ? _t("Object.IMAGESUPLOADHEADING", "<span style='color: green'>Sort images by draging thumbnail</span>") : _t("Object.IMAGESUPLOADHEADINGWRONG", "<span style='color: red'>Sorting images by draging thumbnails (SortOrder) not allowed. Missing module SortabeUploadField.</span>");
} else {
$message = _t("Object.IMAGESSORTERNOTICE", "Correct image sorting is visible on frontend only (if Sort by = Title, ID)");
}
$dropdownSorter = DropdownField::create('Sorter', _t("Object.IMAGESSORTER", "Sort images by: "))->setSource($this->owner->dbObject('Sorter')->enumValues());
$fields->addFieldToTab('Root.Images', $dropdownSorter);
$fields->addFieldToTab('Root.Images', HeaderField::create('ImagesNotice', $message)->setHeadingLevel(4));
}
$fields->addFieldToTab('Root.Images', $imageField);
} else {
$fields->removeByName($imagesTab->Name);
}
}
示例11: updateCMSFields
/**
* Returns a FieldList with which to create the editing form. {@link SiteTree::getCMSFields()}
*/
public function updateCMSFields(FieldList $fields)
{
$placeholderImageUploadField = new UploadField('PlaceholderImage', _t('PlaceholderImageSiteConfigExtension.PLACEHOLDERIMAGE', 'Placeholder Image'));
$placeholderImageUploadField->allowedExtensions = array('jpg', 'gif', 'png');
$fields->findOrMakeTab('Root.Images', _t('PlaceholderImageSiteConfigExtension.IMAGES', 'Images'));
$fields->addFieldToTab('Root.Images', $placeholderImageUploadField);
}
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-imagefunctions,代码行数:10,代码来源:PlaceholderImageSiteConfigExtension.php
示例12: updateCMSFields
/**
* @param FieldList
*/
public function updateCMSFields(FieldList $fields)
{
if (!method_exists($this->owner, "getSettingsFields")) {
$tabset = $fields->findOrMakeTab('Root.Settings');
$tabset->push(new HeaderField(_t('GoogleShoppingFeed.GoogleShoppingFeed', 'Google Shopping Feed')));
$tabset->push(new CheckboxField("RemoveFromShoppingFeed"));
}
}
示例13: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
/** -----------------------------------------
* Settings
* ----------------------------------------*/
if (!$fields->fieldByName('Root.Settings')) {
$fields->addFieldToTab('Root', TabSet::create('Settings'));
}
/** -----------------------------------------
* Images
* ----------------------------------------*/
$fields->findOrMakeTab('Root.Settings.Images', 'Images');
/** @var UploadField $favicon */
$fields->addFieldsToTab('Root.Settings.Images', array(HeaderField::create('ImagesTabHeading', _t('BoilerplateSiteConfigExtension.ImagesTabHeading', 'Images')), $logo = UploadField::create('LogoImage', _t('BoilerplateSiteConfigExtension.Logo', 'Logo')), $mobileLogo = UploadField::create('MobileLogoImage', _t('BoilerplateSiteConfigExtension.MobileLogoImage', 'Mobile Menu Logo (optional)')), $favicon = UploadField::create('Favicon', _t('BoilerplateSiteConfigExtension.Favicon', 'Favicon'))));
$favicon->setRightTitle(_t('BoilerplateSiteConfigExtension.FaviconRightTitle', 'Choose an Image For Your Favicon (16px by 16px)'));
/** -----------------------------------------
* Company Details
* ----------------------------------------*/
$fields->findOrMakeTab('Root.Settings.Details', 'Details');
/**
* @var TextareaField $address
* @var TextareaField $postalAddress
* @var TextareaField $directions
*/
$fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('DetailsTabHeading', _t('BoilerplateSiteConfigExtension.DetailsTabHeading', 'General')), Textfield::create('Phone', _t('BoilerplateSiteConfigExtension.Phone', 'Phone Number')), Textfield::create('Email', _t('BoilerplateSiteConfigExtension.Email', 'Public Email Address')), $address = TextareaField::create('Address', _t('BoilerplateSiteConfigExtension.Address', 'Address')), $postalAddress = TextareaField::create('PostalAddress', _t('BoilerplateSiteConfigExtension.PostalAddress', 'Postal Address')), $directions = TextareaField::create('Directions', _t('BoilerplateSiteConfigExtension.Directions', 'Google Map Directions')), HeaderField::create('DetailsTabSocialMediaHeading', _t('BoilerplateSiteConfigExtension.DetailsTabSocialMediaHeading', 'Social Media')), TextField::create('Facebook', _t('BoilerplateSiteConfigExtension.Facebook', 'Facebook')), TextField::create('Twitter', _t('BoilerplateSiteConfigExtension.Twitter', 'Twitter')), TextField::create('Youtube', _t('BoilerplateSiteConfigExtension.Youtube', 'Youtube')), TextField::create('GooglePlus', _t('BoilerplateSiteConfigExtension.GooglePlus', 'Google+'))));
$address->setRows(8);
$postalAddress->setRows(8);
$directions->setRows(3);
$directions->setRightTitle(_t('DirectionsRightTitle', 'The URL of the Address on <a href="https://www.google.com/maps" title="Google Maps" rel="nofollow" target="_blank">Google Maps</a>. This is useful for users on mobile granting the ability to open directions in their native applications.'));
/** -----------------------------------------
* Analytics
* ----------------------------------------*/
if (Permission::check('ADMIN')) {
$fields->findOrMakeTab('Root.Settings.Analytics', 'Analytics');
/**
* @var TextareaField $googleSiteVerification
* @var TextareaField $trackingCode
* @var TextareaField $tagManagerFieldGroup
*/
$fields->addFieldsToTab('Root.Settings.Analytics', array(HeaderField::create('', 'Analytics'), $googleSiteVerification = TextareaField::create('GoogleSiteVerification', _t('BoilerplateSiteConfigExtension.GoogleSiteVerification', 'Google Site Verification Code')), $trackingCode = TextareaField::create('TrackingCode', _t('BoilerplateSiteConfigExtension.TrackingCode', 'Tracking Code')), $tagManagerFieldGroup = FieldGroup::create(CheckboxField::create('TagManager', _t('BoilerplateSiteConfigExtension.TagManager', 'Does the tracking code above contain Google Tag Manager?')))));
$googleSiteVerification->setRows(2);
$trackingCode->setRows(20);
$tagManagerFieldGroup->setTitle(_t('BoilerplateSiteConfigExtension.TagManagerRightTitle', 'Tag Manager'));
}
}
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:48,代码来源:BoilerplateSiteConfigExtension.php
示例14: updateCMSFields
/**
* @param FieldSet $fields
*/
public function updateCMSFields(FieldList $fields)
{
$fields->findOrMakeTab('Root.Schedule', _t('ScheduledExecution.ScheduleTabTitle', 'Schedule'));
$fields->addFieldsToTab('Root.Schedule', array($dt = new Datetimefield('FirstExecution', _t('ScheduledExecution.FIRST_EXECUTION', 'First Execution')), FieldGroup::create(new NumericField('ExecuteInterval', ''), new DropdownField('ExecuteEvery', '', array('' => '', 'Minute' => _t('ScheduledExecution.ExecuteEveryMinute', 'Minute'), 'Hour' => _t('ScheduledExecution.ExecuteEveryHour', 'Hour'), 'Day' => _t('ScheduledExecution.ExecuteEveryDay', 'Day'), 'Week' => _t('ScheduledExecution.ExecuteEveryWeek', 'Week'), 'Fortnight' => _t('ScheduledExecution.ExecuteEveryFortnight', 'Fortnight'), 'Month' => _t('ScheduledExecution.ExecuteEveryMonth', 'Month'), 'Year' => _t('ScheduledExecution.ExecuteEveryYear', 'Year'))))->setTitle(_t('ScheduledExecution.EXECUTE_EVERY', 'Execute every')), new TextField('ExecuteFree', _t('ScheduledExecution.EXECUTE_FREE', 'Scheduled (in strtotime format from first execution)'))));
if ($this->owner->ScheduledJobID) {
$jobTime = $this->owner->ScheduledJob()->StartAfter;
$fields->addFieldsToTab('Root.Schedule', array(new ReadonlyField('NextRunDate', _t('ScheduledExecution.NEXT_RUN_DATE', 'Next run date'), $jobTime)));
}
$dt->getDateField()->setConfig('showcalendar', true);
$dt->getTimeField()->setConfig('showdropdown', true);
}
示例15: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
/* -----------------------------------------
* Comments
------------------------------------------*/
$fields->findOrMakeTab('Root.Settings.Comments', 'Comments');
$fields->addFieldsToTab('Root.Settings.Comments', array($disqusForumShortName = new TextField('DisqusForumShortName', 'Disqus forum shortname')));
if (!SiteConfig::current_site_config()->DisqusForumShortName) {
$disqusForumShortName->setRightTitle('Enables Disqus commenting on blog items. Sign up for your Disqus account at: <a href="http://disqus.com/" target="_blank">http://disqus.com/</a>');
}
}