本文整理汇总了PHP中TextField::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::setDescription方法的具体用法?PHP TextField::setDescription怎么用?PHP TextField::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name, $title = null, $value = null, $form = null)
{
$allowed_types = $this->stat('allowed_types');
$field_types = $this->stat('field_types');
if (empty($allowed_types)) {
$allowed_types = array_keys($field_types);
}
$field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types));
$field->setEmptyString('Please choose the Link Type');
$this->composite_fields['Type'] = $field;
foreach ($allowed_types as $type) {
$def = $field_types[$type];
$field_name = "{$name}[{$type}]";
switch ($def['field']) {
case 'TreeDropdownField':
$field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title');
break;
default:
$field = new TextField($field_name, '');
break;
}
$field->setDescription($def['description']);
$field->addExtraClass('FlexiLinkCompositeField');
$this->composite_fields[$type] = $field;
}
$this->setForm($form);
parent::__construct($name, $title, $value, $form);
}
示例2: index
public function index()
{
$language = OW::getLanguage();
$billingService = BOL_BillingService::getInstance();
$adminForm = new Form('adminForm');
$element = new TextField('creditValue');
$element->setRequired(true);
$element->setLabel($language->text('billingcredits', 'admin_usd_credit_value'));
$element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc'));
$element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue'));
$validator = new FloatValidator(0.1);
$validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format'));
$element->addValidator($validator);
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue($language->text('billingcredits', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']);
OW::getFeedback()->info($language->text('billingcredits', 'user_save_success'));
}
}
$this->addForm($adminForm);
$this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
$this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
$this->setPageHeadingIconClass('ow_ic_app');
}
示例3: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$field = new TextField('public_key');
$field->addValidator(new ConfigRequireValidator());
$this->addElement($field);
$field = new CheckboxField('billing_enabled');
$this->addElement($field);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
$promoUrl = new TextField('app_url');
$promoUrl->setRequired();
$promoUrl->addValidator(new UrlValidator());
$promoUrl->setLabel($language->text('skandroid', 'app_url_label'));
$promoUrl->setDescription($language->text('skandroid', 'app_url_desc'));
$promoUrl->setValue(OW::getConfig()->getValue('skandroid', 'app_url'));
$this->addElement($promoUrl);
$smartBanner = new CheckboxField('smart_banner');
$smartBanner->setLabel($language->text('skandroid', 'smart_banner_label'));
$smartBanner->setDescription($language->text('skandroid', 'smart_banner_desc'));
$smartBanner->setValue(OW::getConfig()->getValue('skandroid', 'smart_banner'));
$this->addElement($smartBanner);
}
示例4: __construct
/**
* Class constructor
*
*/
public function __construct($configs)
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$field = new RadioField('itunes_mode');
$field->setOptions(array("test" => $language->text("skadateios", "itunes_mode_test"), "live" => $language->text("skadateios", "itunes_mode_live")));
$field->setValue($configs["itunes_mode"]);
$this->addElement($field);
$field = new CheckboxField('billing_enabled');
$field->setValue($configs["billing_enabled"]);
$this->addElement($field);
$field = new TextField('itunes_secret');
$field->addValidator(new ConfigRequireValidator());
$field->setValue($configs["itunes_secret"]);
$this->addElement($field);
$promoUrl = new TextField('app_url');
$promoUrl->setRequired();
$promoUrl->addValidator(new UrlValidator());
$promoUrl->setLabel($language->text('skadateios', 'app_url_label'));
$promoUrl->setDescription($language->text('skadateios', 'app_url_desc'));
$promoUrl->setValue($configs['app_url']);
$this->addElement($promoUrl);
$smartBanner = new CheckboxField('smart_banner');
$smartBanner->setLabel($language->text('skadateios', 'smart_banner_label'));
$smartBanner->setDescription($language->text('skadateios', 'smart_banner_desc'));
$smartBanner->setValue($configs['smart_banner']);
$this->addElement($smartBanner);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Contact Form settings
$recipient_field = new EmailField('DefaultRecipient', 'Email recipient');
$recipient_field->setDescription('Default email address to send submissions to.');
$subject_field = new TextField('Subject', 'Email subject');
$subject_field->setDescription('Subject for the email.');
$default_from_field = new EmailField('DefaultFrom', 'Email from');
$default_from_field->setDescription('Default from email address.');
$fields->addFieldToTab('Root.ContactForm.Settings', $recipient_field);
$fields->addFieldToTab('Root.ContactForm.Settings', $subject_field);
$fields->addFieldToTab('Root.ContactForm.Settings', $default_from_field);
// Contact Form fields
$conf = GridFieldConfig_RelationEditor::create(10);
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
$data_columns = $conf->getComponentByType('GridFieldDataColumns');
$data_columns->setDisplayFields(array('Name' => 'Name', 'Type' => 'Type', 'requiredText' => 'Required'));
$contact_form_fields = new GridField('Fields', 'Field', $this->ContactFields(), $conf);
$fields->addFieldToTab('Root.ContactForm.Fields', $contact_form_fields);
// Recipient map
$contact_fields = array();
foreach ($this->ContactFields() as $contact_field) {
$contact_fields[$contact_field->Name] = $contact_field->Name;
}
$recipient_map_field_field = new DropdownField('RecipientMapField', 'Recipient Map Field', $contact_fields);
$recipient_map_field_field->setDescription('Field used to map recipients.');
$recipient_map_field = new TextareaField('RecipientMap', 'Recipient Map');
$recipient_map_field->setDescription('Map field values to an email address (format: value:email address) one per line.');
$fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field_field);
$fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field);
return $fields;
}
示例6: updateCMSFields
public function updateCMSFields(\FieldList $fields)
{
$tabTitle = _t('SiteConfigExtension.TABSITEINFO', "Site Infos");
// add a Logo to whole sites
$fields->addFieldToTab('Root.' . $tabTitle, new UploadField('Logo', _t('SiteConfigExtension.LOGO', 'Logo')));
$latField = new TextField('Lat', _t('SiteConfigExtension.LATITUDE', 'Latitude'));
$lngField = new TextField('Lng', _t('SiteConfigExtension.LONGITUDE', 'Longitude'));
$lngField->setDescription(_t('SiteConfigExtension.GEOINFO', 'Get latitude & longitude values here: <a href="http://itouchmap.com/latlong.html" target="_blank">itouchmap.com</a>.'));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Company', _t('SiteConfigExtension.COMPANY', 'Company')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('SiteOwner', _t('SiteConfigExtension.SITEOWNER', 'Owner')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Street', _t('SiteConfigExtension.STREET', 'Street')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('HouseNumber', _t('SiteConfigExtension.HOUSENUMBER', 'Housenumber')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Zipcode', _t('SiteConfigExtension.ZIPCODE', 'Zipcode')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Destination', _t('SiteConfigExtension.DESTINATION', 'City')));
$fields->addFieldToTab('Root.' . $tabTitle, $latField);
$fields->addFieldToTab('Root.' . $tabTitle, $lngField);
$fields->addFieldToTab('Root.' . $tabTitle, new EmailField('Email', _t('SiteConfigExtension.EMAIL', 'Email')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Phone', _t('SiteConfigExtension.PHONE', 'Phone')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Mobile', _t('SiteConfigExtension.MOBILE', 'Mobile')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Fax', _t('SiteConfigExtension.FAX', 'Fax')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Twitter', _t('SiteConfigExtension.TWITTER', 'Twitter')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Facebook', _t('SiteConfigExtension.FACEBOOK', 'Facebook')));
$fields->addFieldToTab('Root.' . $tabTitle, new TextField('Google', _t('SiteConfigExtension.GOOGLE', 'Google+')));
$fields->addFieldToTab('Root.' . $tabTitle, new HtmlEditorField('Message', _t('SiteConfigExtension.MESSAGE', 'Message')));
}
开发者ID:helpfulrobot,项目名称:hpmewes-silverstripe-siteconfigextension,代码行数:25,代码来源:SiteConfigExtension.php
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// Add back metatitle
$fields->fieldByName('Root.Main.Metadata')->insertBefore($metaTitle = new TextField('MetaTitle', 'Meta Title'), 'MetaDescription');
$metaTitle->setDescription('Browsers will display this in the title bar and search engines use this for displaying search results (although it may not influence their ranking).');
// Record current CMS page, quite useful for sorting etc
self::$current_cms_page = $this->owner->ID;
}
示例8: getSettingsFields
public function getSettingsFields()
{
$fields = parent::getSettingsFields();
Requirements::javascript('eventmanagement/javascript/cms.js');
$fields->addFieldsToTab('Root.Registration', array(new CheckboxField('OneRegPerEmail', _t('EventManagement.ONE_REG_PER_EMAIL', 'Limit to one registration per email address?')), new CheckboxField('RequireLoggedIn', _t('EventManagement.REQUIRE_LOGGED_IN', 'Require users to be logged in to register?')), $limit = new NumericField('RegistrationTimeLimit', _t('EventManagement.REG_TIME_LIMIT', 'Registration time limit'))));
$limit->setDescription(_t('EventManagement.REG_TIME_LIMIT_NOTE', 'The time limit to complete registration, in seconds. Set to 0 to disable place holding.'));
$fields->addFieldsToTab('Root.Email', array(new EmailField('EventManagerEmail', _t('EventManagement.EMAIL_EVENT_MANAGER', 'Event manager email to receive registration notifications?')), new CheckboxField('RegEmailConfirm', _t('EventManagement.REQ_EMAIL_CONFIRM', 'Require email confirmation to complete free registrations?')), $info = new TextField('EmailConfirmMessage', _t('EventManagement.EMAIL_CONFIRM_INFO', 'Email confirmation information')), $limit = new NumericField('ConfirmTimeLimit', _t('EventManagement.EMAIL_CONFIRM_TIME_LIMIT', 'Email confirmation time limit')), new CheckboxField('UnRegEmailConfirm', _t('EventManagement.REQ_UN_REG_EMAIL_CONFIRM', 'Require email confirmation to un-register?')), new CheckboxField('EmailNotifyChanges', _t('EventManagement.EMAIL_NOTIFY_CHANGES', 'Notify registered users of event changes via email?')), new CheckboxSetField('NotifyChangeFields', _t('EventManagement.NOTIFY_CHANGE_IN', 'Notify of changes in'), singleton('RegistrableDateTime')->fieldLabels(false))));
$info->setDescription(_t('EventManagement.EMAIL_CONFIRM_INFO_NOTE', 'This message is displayed to users to let them know they need to confirm their registration.'));
$limit->setDescription(_t('EventManagement.CONFIRM_TIME_LIMIT_NOTE', 'The time limit to conform registration, in seconds. Set to 0 for no limit.'));
return $fields;
}
示例9: __construct
public function __construct($name, $title = null, $value = null, $form = null)
{
$choices = $this->stat('choices');
$field = new DropdownField("{$name}[Select]", '', array_combine($choices, $choices));
$field->setEmptyString(_t('FlexiChoiceField.USE_OPTIONAL', "None - use provided text"));
$this->composite_fields['Select'] = $field;
$field = new TextField("{$name}[Text]", '');
$field->setDescription(_t('FlexiChoiceField.TEXT_DESCRIPTION', 'Use this text in place of a selection.'));
$this->composite_fields['Text'] = $field;
$this->setForm($form);
parent::__construct($name, $title, $value, $form);
}
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new TextField('Title'));
$externalLink = new TextField('ExternalLink');
$externalLink->setDescription('e.g. http://www.mydomain.com');
$fields->addFieldToTab('Root.Main', $externalLink);
$fields->addFieldToTab('Root.Main', new TreeDropdownField('RelatedPageID', 'Choose Page', 'SiteTree'));
$fields->addFieldToTab('Root.Main', new CheckboxField('OpenInNewWindow', 'Open link in new window'));
$fields->addFieldToTab('Root.Main', new CheckboxField('ShowInWidget', 'Show news in News Widget'));
return $fields;
}
示例11: updateFormFields
/**
* Updates the form fields for address'es to use a dropdown for the state and an additional field for the other state
* @param {FieldList} $fields Fields to modify
*/
public function updateFormFields(FieldList $fields)
{
$stateField = $fields->dataFieldByName('State');
if ($stateField) {
$newStateField = new GroupedDropdownField('State', $stateField->Title, array(_t('FedExStateProvinceExtension.UNITED_STATES', '_United States') => array('AL' => _t('FedExStateProvinceExtension.US_AL', '_Alabama'), 'LA' => _t('FedExStateProvinceExtension.US_LA', '_Louisiana'), 'OK' => _t('FedExStateProvinceExtension.US_OK', '_Oklahoma'), 'AK' => _t('FedExStateProvinceExtension.US_AK', '_Alaska'), 'ME' => _t('FedExStateProvinceExtension.US_ME', '_Maine'), 'OR' => _t('FedExStateProvinceExtension.US_OR', '_Oregon'), 'AZ' => _t('FedExStateProvinceExtension.US_AZ', '_Arizona'), 'MD' => _t('FedExStateProvinceExtension.US_MD', '_Maryland'), 'PA' => _t('FedExStateProvinceExtension.US_PA', '_Pennsylvania'), 'AR' => _t('FedExStateProvinceExtension.US_AR', '_Arkansas'), 'MA' => _t('FedExStateProvinceExtension.US_MA', '_Massachusetts'), 'RI' => _t('FedExStateProvinceExtension.US_RI', '_Rhode Island'), 'CA' => _t('FedExStateProvinceExtension.US_CA', '_California'), 'MI' => _t('FedExStateProvinceExtension.US_MI', '_Michigan'), 'SC' => _t('FedExStateProvinceExtension.US_SC', '_South Carolina'), 'CO' => _t('FedExStateProvinceExtension.US_CO', '_Colorado'), 'MN' => _t('FedExStateProvinceExtension.US_MN', '_Minnesota'), 'SD' => _t('FedExStateProvinceExtension.US_SD', '_South Dakota'), 'CT' => _t('FedExStateProvinceExtension.US_CT', '_Connecticut'), 'MS' => _t('FedExStateProvinceExtension.US_MS', '_Mississippi'), 'TN' => _t('FedExStateProvinceExtension.US_TN', '_Tennessee'), 'DE' => _t('FedExStateProvinceExtension.US_DE', '_Delaware'), 'MO' => _t('FedExStateProvinceExtension.US_MO', '_Missouri'), 'TX' => _t('FedExStateProvinceExtension.US_TX', '_Texas'), 'DC' => _t('FedExStateProvinceExtension.US_DC', '_District of Columbia'), 'MT' => _t('FedExStateProvinceExtension.US_MT', '_Montana'), 'UT' => _t('FedExStateProvinceExtension.US_UT', '_Utah'), 'FL' => _t('FedExStateProvinceExtension.US_FL', '_Florida'), 'NE' => _t('FedExStateProvinceExtension.US_NE', '_Nebraska'), 'VT' => _t('FedExStateProvinceExtension.US_VT', '_Vermont'), 'GA' => _t('FedExStateProvinceExtension.US_GA', '_Georgia'), 'NV' => _t('FedExStateProvinceExtension.US_NV', '_Nevada'), 'VA' => _t('FedExStateProvinceExtension.US_VA', '_Virginia'), 'HI' => _t('FedExStateProvinceExtension.US_HI', '_Hawaii'), 'NH' => _t('FedExStateProvinceExtension.US_NH', '_New Hampshire'), 'WA' => _t('FedExStateProvinceExtension.US_WA', '_Washington State'), 'ID' => _t('FedExStateProvinceExtension.US_ID', '_Idaho'), 'NJ' => _t('FedExStateProvinceExtension.US_NJ', '_New Jersey'), 'WV' => _t('FedExStateProvinceExtension.US_WV', '_West Virginia'), 'IL' => _t('FedExStateProvinceExtension.US_IL', '_Illinois'), 'NM' => _t('FedExStateProvinceExtension.US_NM', '_New Mexico'), 'WI' => _t('FedExStateProvinceExtension.US_WI', '_Wisconsin'), 'IN' => _t('FedExStateProvinceExtension.US_IN', '_Indiana'), 'NY' => _t('FedExStateProvinceExtension.US_NY', '_New York'), 'WY' => _t('FedExStateProvinceExtension.US_WY', '_Wyoming'), 'IA' => _t('FedExStateProvinceExtension.US_IA', '_Iowa'), 'NC' => _t('FedExStateProvinceExtension.US_NC', '_North Carolina'), 'PR' => _t('FedExStateProvinceExtension.US_PR', '_Puerto Rico'), 'KS' => _t('FedExStateProvinceExtension.US_KS', '_Kansas'), 'ND' => _t('FedExStateProvinceExtension.US_ND', '_North Dakota'), 'KY' => _t('FedExStateProvinceExtension.US_KY', '_Kentucky'), 'OH' => _t('FedExStateProvinceExtension.US_OH', '_Ohio')), _t('FedExStateProvinceExtension.CANADA', '_Canada') => array('AB' => _t('FedExStateProvinceExtension.CA_AB', '_Alberta'), 'BC' => _t('FedExStateProvinceExtension.CA_BC', '_British Columbia'), 'MB' => _t('FedExStateProvinceExtension.CA_MB', '_Manitoba'), 'NB' => _t('FedExStateProvinceExtension.CA_NB', '_New Brunswick'), 'NL' => _t('FedExStateProvinceExtension.CA_NL', '_Newfoundland'), 'NT' => _t('FedExStateProvinceExtension.CA_NT', '_Northwest Territories and Labrador'), 'NS' => _t('FedExStateProvinceExtension.CA_NS', '_Nova Scotia'), 'NU' => _t('FedExStateProvinceExtension.CA_NU', '_Nunavut'), 'ON' => _t('FedExStateProvinceExtension.CA_ON', '_Ontario'), 'PE' => _t('FedExStateProvinceExtension.CA_PE', '_Prince Edward Island'), 'QC' => _t('FedExStateProvinceExtension.CA_QC', '_Quebec'), 'SK' => _t('FedExStateProvinceExtension.CA_SK', '_Saskatchewan'), 'YT' => _t('FedExStateProvinceExtension.CA_YT', '_Yukon')), '' => _t('FedExStateProvinceExtension.OTHER', '_Other')));
$newStateField->setDescription = $stateField->getDescription();
$newStateField->setForm($stateField->getForm());
$fields->replaceField('State', $newStateField);
$fields->insertAfter($otherState = new TextField('OtherState', _t('FedExStateProvinceExtension.OTHER_STATE', '_Other State'), null, 200), 'State');
$otherState->setDescription(_t('FedExStateProvinceExtension.OTHER_DESC', '_If you chose other as your state please place it here'));
$otherState->setForm($stateField->getForm());
}
}
开发者ID:webbuilders-group,项目名称:silverstripe-shop-fedex-shipping,代码行数:17,代码来源:FedExStateProvinceExtension.php
示例12: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName('Theme');
if (Config::inst()->get('SiteConfig', 'can_select_theme')) {
$themeDropdownField = new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemesExtended());
$themeDropdownField->setEmptyString(_t('SiteConfig.DEFAULTTHEME', '(Use default theme)'));
$fields->addFieldToTab('Root.Theme', $themeDropdownField);
}
// Colors
$fields->addFieldToTab('Root.Theme', new HeaderField('ColorH', _t('ThemeSiteConfigExtension.ColorH', 'Colors')));
$fields->addFieldToTab('Root.Theme', $BaseColor = new MiniColorsField('BaseColor', _t('ThemeSiteConfigExtension.BaseColor', 'Base Color')));
$BaseColor->setDescription(_t('ThemeSiteConfigExtension.BaseColorDesc', "The background color of your website"));
$fields->addFieldToTab('Root.Theme', new MiniColorsField('PrimaryColor', _t('ThemeSiteConfigExtension.PrimaryColor', 'Primary Color')));
$fields->addFieldToTab('Root.Theme', new MiniColorsField('HoverColor', _t('ThemeSiteConfigExtension.HoverColor', 'Hover Color')));
$fields->addFieldToTab('Root.Theme', new MiniColorsField('SecondaryColor', _t('ThemeSiteConfigExtension.SecondaryColor', 'Secondary Color')));
$fields->addFieldToTab('Root.Theme', new MiniColorsField('CtaColor', _t('ThemeSiteConfigExtension.CtaColor', 'Call To Action Color')));
// Fonts
$fields->addFieldToTab('Root.Theme', new HeaderField('FontsH', _t('ThemeSiteConfigExtension.FontsH', 'Fonts')));
$fields->addFieldToTab('Root.Theme', $hf = new TextField('HeaderFont', _t('ThemeSiteConfigExtension.HeaderFont', 'Header Font')));
$fields->addFieldToTab('Root.Theme', $hfw = new TextField('HeaderFontWeight', _t('ThemeSiteConfigExtension.HeaderFontWeight', 'Header Font Weight')));
$fields->addFieldToTab('Root.Theme', $bf = new TextField('BodyFont', _t('ThemeSiteConfigExtension.BodyFont', 'Body Font')));
$fields->addFieldToTab('Root.Theme', $bfw = new TextField('BodyFontWeight', _t('ThemeSiteConfigExtension.BodyFontWeight', 'Body Font Weight')));
$fields->addFieldToTab('Root.Theme', $gf = new TextField('GoogleFonts', _t('ThemeSiteConfigExtension.GoogleFonts', 'Google Fonts')));
$hf->setAttribute('placeholder', 'Arial, Helvetica, sans-serif');
$bf->setAttribute('placeholder', 'Arial, Helvetica, sans-serif');
$gf->setDescription('family=Open+Sans:400italic,400,600&subset=latin,latin-ext');
// Images
$fields->addFieldToTab('Root.Theme', new HeaderField('ImagesH', _t('ThemeSiteConfigExtension.ImagesH', 'Images')));
$fields->addFieldToTab('Root.Theme', ImageUploadField::createForClass($this, 'Logo', _t('ThemeSiteConfigExtension.Logo', 'Logo')));
$fields->addFieldToTab('Root.Theme', $icon = ImageUploadField::createForClass($this, 'Icon', _t('ThemeSiteConfigExtension.Icon', 'Icon')));
$fields->addFieldToTab('Root.Theme', ImageUploadField::createForClass($this, 'FooterImage', _t('ThemeSiteConfigExtension.FooterImage', 'Footer Image')));
if (is_file(Director::baseFolder() . $this->FaviconPath())) {
$icon->setDescription(_t('ThemeSiteConfigExtension.FaviconPreview', 'Favicon preview') . ' <img src="' . $this->FaviconPath() . '" alt="Favicon" />');
} else {
$icon->setDescription(_t('ThemeSiteConfigExtension.NoFavicon', 'No favicon created for this site'));
}
$fields->addFieldToTab('Root.Theme', ImageUploadField::createForClass($this, 'BackgroundImages', _t('ThemeSiteConfigExtension.BackgroundImages', 'Background Images')));
$fields->addFieldToTab('Root.Theme', new DropdownField('BackgroundRepeat', _t('ThemeSiteConfigExtension.BackgroundRepeat', 'Background Repeat'), array(self::BACKGROUND_NO_REPEAT => 'no repeat', self::BACKGROUND_REPEAT => 'repeat', self::BACKGROUND_REPEAT_X => 'repeat x', self::BACKGROUND_REPEAT_Y => 'repeat y')));
if (Director::isDev() || Permission::check('ADMIN')) {
$fields->addFieldToTab('Root.Theme', new HeaderField('ThemeDevHeader', 'Dev tools'));
$fields->addFieldToTab('Root.Theme', new CheckboxField('RefreshTheme'));
$fields->addFieldToTab('Root.Theme', new CheckboxField('RefreshIcon'));
}
// Simple Google Analytics helper, disable if other extension are found
if (!$this->owner->hasExtension('GoogleConfig') && !$this->owner->hasExtension('ZenGoogleAnalytics')) {
$fields->addFieldToTab('Root.Main', $ga = new TextField('GoogleAnalyticsCode'));
$ga->setAttribute('placeholder', 'UA-0000000-00');
}
return $fields;
}
示例13: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$description = 'This is <strong>bold</strong> help text';
$fields->addFieldsToTab('Root.Text', array(Object::create('TextField', 'Required', 'Required field'), Object::create('TextField', 'Validated', 'Validated field (checks range between 1 and 3)'), Object::create('ReadonlyField', 'Readonly', 'ReadonlyField'), Object::create('TextareaField', 'Textarea', 'TextareaField - 8 rows')->setRows(8), Object::create('TextField', 'Text', 'TextField'), Object::create('HtmlEditorField', 'HTMLField', 'HtmlEditorField'), Object::create('EmailField', 'Email', 'EmailField'), Object::create('PasswordField', 'Password', 'PasswordField')));
$fields->addFieldsToTab('Root.Numeric', array(Object::create('NumericField', 'Number', 'NumericField'), Object::create('CurrencyField', 'Price', 'CurrencyField'), Object::create('MoneyField', 'Money', 'MoneyField', array('Amount' => 99.98999999999999, 'Currency' => 'EUR')), Object::create('PhoneNumberField', 'PhoneNumber', 'PhoneNumberField'), Object::create('CreditCardField', 'CreditCard', 'CreditCardField')));
$fields->addFieldsToTab('Root.Option', array(Object::create('CheckboxField', 'Checkbox', 'CheckboxField'), Object::create('CheckboxSetField', 'CheckboxSet', 'CheckboxSetField', TestCategory::map()), Object::create('DropdownField', 'DropdownID', 'DropdownField', TestCategory::map())->setHasEmptyDefault(true), Object::create('GroupedDropdownField', 'GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map())), Object::create('ListboxField', 'ListboxFieldID', 'ListboxField', TestCategory::map())->setSize(3), Object::create('ListboxField', 'MultipleListboxFieldID', 'ListboxField (multiple)', TestCategory::map())->setMultiple(true)->setSize(3), Object::create('OptionsetField', 'OptionSet', 'OptionSetField', TestCategory::map()), Object::create('ToggleCompositeField', 'ToggleCompositeField', 'ToggleCompositeField', new FieldList(Object::create('TextField', 'ToggleCompositeTextField1'), Object::create('TextField', 'ToggleCompositeTextField2'), Object::create('DropdownField', 'ToggleCompositeDropdownField', 'ToggleCompositeDropdownField', TestCategory::map()), Object::create('TextField', 'ToggleCompositeTextField3')))));
// All these date/time fields generally have issues saving directly in the CMS
$fields->addFieldsToTab('Root.DateTime', array($calendarDateField = Object::create('DateField', 'CalendarDate', 'DateField with calendar'), Object::create('DateField', 'Date', 'DateField'), $dmyDateField = Object::create('DateField', 'DMYDate', 'DateField with separate fields'), Object::create('TimeField', 'Time', 'TimeField'), $timeFieldDropdown = Object::create('TimeField', 'TimeWithDropdown', 'TimeField with dropdown'), Object::create('DatetimeField', 'DateTime', 'DateTime'), $dateTimeShowCalendar = Object::create('DatetimeField', 'DateTimeWithCalendar', 'DateTime with calendar')));
$calendarDateField->setConfig('showcalendar', true);
$dmyDateField->setConfig('dmyfields', true);
$timeFieldDropdown->setConfig('showdropdown', true);
$dateTimeShowCalendar->getDateField()->setConfig('showcalendar', true);
$dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
$fields->addFieldsToTab('Root.File', array($bla = UploadField::create('File', 'FileUploadField')->setDescription($description)->setConfig('allowedMaxFileNumber', 1)->setConfig('canPreviewFolder', false), UploadField::create('AttachedFile', 'UploadField with canUpload=false')->setDescription($description)->setConfig('canUpload', false), UploadField::create('Image', 'UploadField for image')->setDescription($description), UploadField::create('HasManyFiles', 'UploadField for has_many')->setDescription($description), UploadField::create('ManyManyFiles', 'UploadField for many_many')->setDescription($description)));
$data = $this->getDefaultData();
foreach ($fields->dataFields() as $field) {
$name = $field->getName();
if (isset($data[$name])) {
$field->setValue($data[$name]);
}
}
$blacklist = array('DMYDate', 'Required', 'Validated', 'ToggleCompositeField');
$tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File');
foreach ($tabs as $tab) {
$tabObj = $fields->fieldByName($tab);
foreach ($tabObj->FieldList() as $field) {
$field->setDescription($description);
// ->addExtraClass('cms-description-tooltip');
if (in_array($field->getName(), $blacklist)) {
continue;
}
$disabledField = $field->performDisabledTransformation();
$disabledField->setTitle($disabledField->Title() . ' (disabled)');
$disabledField->setName($disabledField->getName() . '_disabled');
$tabObj->insertAfter($disabledField, $field->getName());
$readonlyField = $field->performReadonlyTransformation();
$readonlyField->setTitle($readonlyField->Title() . ' (readonly)');
$readonlyField->setName($readonlyField->getName() . '_readonly');
$tabObj->insertAfter($readonlyField, $field->getName());
}
}
$noLabelField = new TextField('Text_NoLabel', false, 'TextField without label');
$noLabelField->setDescription($description);
$fields->addFieldToTab('Root.Text', $noLabelField, 'Text_disabled');
$fields->addFieldToTab('Root.Text', FieldGroup::create(TextField::create('MyFieldGroup1'), TextField::create('MyFieldGroup2'), DropdownField::create('MyFieldGroup3', false, TestCategory::map())));
$fields->addFieldToTab('Root.Text', FieldGroup::create('MyLabelledFieldGroup', array(TextField::create('MyLabelledFieldGroup1'), TextField::create('MyLabelledFieldGroup2'), DropdownField::create('MyLabelledFieldGroup3', null, TestCategory::map())))->setTitle('My Labelled Field Group'));
return $fields;
}
示例14: getCMSFields
/**
* @return FieldList
*/
public function getCMSFields()
{
if (!$this->exists()) {
// The new module state
Requirements::css(MODULATOR_PATH . '/css/PageModule.css');
Requirements::javascript(MODULATOR_PATH . '/javascript/PageModule.js');
$allowedModules = array();
// Determine the type of the parent page
$currentPageID = Session::get('CMSMain.currentPage');
if ($currentPageID) {
$currentPage = SiteTree::get_by_id('SiteTree', $currentPageID);
if ($currentPage) {
$currentPageClass = $currentPage->ClassName;
// Get the list of allowed modules for this page type
if (class_exists($currentPageClass) && method_exists($currentPageClass, 'getAllowedModules')) {
$allowedModules = $currentPageClass::getAllowedModules();
}
}
}
$classList = array();
foreach ($allowedModules as $class) {
$instance = new $class();
$classList[$class] = '<img src="' . $instance::$icon . '"><strong>' . $class::$label . '</strong><p>' . $class::$description . '</p>';
}
$fields = new FieldList();
if (!count($allowedModules)) {
$typeField = new LiteralField('Type', '<span class="message required">There are no module types defined, please create some.</span>');
$fields->push($typeField);
} else {
$labelField = new TextField('Title', 'Label');
$labelField->setDescription('A reference name for this block, not displayed on the website');
$fields->push($labelField);
$typeField = new OptionSetField('NewClassName', 'Type', $classList);
$typeField->setDescription('The type of module determines what content and functionality it will provide');
$fields->push($typeField);
}
$this->extend('updateCMSFields', $fields);
} else {
// Existing module state
$fields = parent::getCMSFields();
// Don't expose Order to the CMS
$fields->removeFieldFromTab('Root.Main', 'Order');
$fields->removeFieldFromTab('Root.Main', 'PageID');
// Helps us keep track of preview focus
$fields->addFieldToTab('Root.Main', new HiddenField('ModulatorID', 'ModulatorID', $this->ID));
}
return $fields;
}
示例15: __construct
/**
* Constructor.
*
* @param array $itemsList
*/
public function __construct($langId)
{
parent::__construct();
$this->service = BOL_LanguageService::getInstance();
if (empty($langId)) {
$this->setVisible(false);
return;
}
$languageDto = $this->service->findById($langId);
if ($languageDto === null) {
$this->setVisible(false);
return;
}
$language = OW::getLanguage();
$form = new Form('lang_edit');
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
$form->setAjaxResetOnSuccess(false);
$labelTextField = new TextField('label');
$labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
$labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
$labelTextField->setRequired();
$labelTextField->setValue($languageDto->getLabel());
$form->addElement($labelTextField);
$tagTextField = new TextField('tag');
$tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
$tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
$tagTextField->setRequired();
$tagTextField->setValue($languageDto->getTag());
if ($languageDto->getTag() == 'en') {
$tagTextField->addAttribute('disabled', 'disabled');
}
$form->addElement($tagTextField);
$rtl = new CheckboxField('rtl');
$rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
$rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
$rtl->setValue((bool) $languageDto->getRtl());
$form->addElement($rtl);
$hiddenField = new HiddenField('langId');
$hiddenField->setValue($languageDto->getId());
$form->addElement($hiddenField);
$submit = new Submit('submit');
$submit->setValue($language->text('admin', 'btn_label_edit'));
$form->addElement($submit);
$form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
$this->addForm($form);
}