本文整理汇总了PHP中DropdownField::create方法的典型用法代码示例。如果您正苦于以下问题:PHP DropdownField::create方法的具体用法?PHP DropdownField::create怎么用?PHP DropdownField::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DropdownField
的用法示例。
在下文中一共展示了DropdownField::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateFields
public function updateFields($fields)
{
$types = $this->allowedItems();
$fields->replaceField('ItemType', DropdownField::create('ItemType', 'Items of type', $types)->setEmptyString('--select type--'));
if ($this->ItemType) {
$list = $this->getFilteredItemList(false);
$dummy = $list->first();
if (!$dummy) {
$dummy = singleton($this->ItemType);
}
$dbFields = $dummy->db();
$dbFields = array_combine(array_keys($dbFields), array_keys($dbFields));
$typeFields = array('ID' => 'ID', 'LastEdited' => 'LastEdited', 'Created' => 'Created');
$additional = $dummy->summaryFields();
$hasOnes = $dummy->has_one();
foreach ($hasOnes as $relName => $relType) {
$dbFields[$relName . 'ID'] = $relName . 'ID';
}
// $hasOnes,
$dbFields = array_merge($typeFields, $dbFields);
//, $additional);
$fields->replaceField('Filter', KeyValueField::create('Filter', 'Filter by', $dbFields));
$fields->replaceField('Include', KeyValueField::create('Include', 'Include where', $dbFields));
$displayAble = array_merge($dbFields, $additional);
$fields->replaceField('DataFields', KeyValueField::create('DataFields', 'Fields in table', $displayAble));
$fields->replaceField('FieldFormatting', KeyValueField::create('FieldFormatting', 'Formatting for fields', $displayAble));
$fields->replaceField('SortBy', KeyValueField::create('SortBy', 'Sorting', $dbFields, array('ASC' => 'ASC', 'DESC' => 'DESC')));
}
}
示例2: getCardFields
public function getCardFields()
{
$months = array();
//generate list of months
for ($x = 1; $x <= 12; $x++) {
$months[$x] = date('m - F', mktime(0, 0, 0, $x, 1));
}
$year = date("Y");
$range = 5;
$startrange = range(date("Y", strtotime("-{$range} years")), $year);
$expiryrange = range($year, date("Y", strtotime("+{$range} years")));
$fields = array("type" => DropdownField::create('type', _t("PaymentForm.TYPE", "Type"), $this->getCardTypes()), "name" => TextField::create('name', _t("PaymentForm.NAME", "Name on Card")), "number" => TextField::create('number', _t("PaymentForm.NUMBER", "Card Number"))->setDescription(_t("PaymentForm.NUMBERDESCRIPTION", "no dashes or spaces")), "startMonth" => DropdownField::create('startMonth', _t("PaymentForm.STARTMONTH", "Month"), $months), "startYear" => DropdownField::create('startYear', _t("PaymentForm.STARTYEAR", "Year"), array_combine($startrange, $startrange), $year), "expiryMonth" => DropdownField::create('expiryMonth', _t("PaymentForm.EXPIRYMONTH", "Month"), $months), "expiryYear" => DropdownField::create('expiryYear', _t("PaymentForm.EXPIRYYEAR", "Year"), array_combine($expiryrange, $expiryrange), $year), "cvv" => TextField::create('cvv', _t("PaymentForm.CVV", "Security Code"))->setMaxLength(5), "issueNumber" => TextField::create('issueNumber', _t("PaymentForm.ISSUENUMBER", "Issue Number")));
//assumption: no credit card fields are ever required for off-site gateways by default
$defaults = GatewayInfo::is_offsite($this->gateway) ? array() : array('name', 'number', 'expiryMonth', 'expiryYear', 'cvv');
$this->cullForGateway($fields, $defaults);
//optionally group date fields
if ($this->groupdatefields) {
if (isset($fields['startMonth']) && isset($fields['startYear'])) {
$fields['startMonth'] = new FieldGroup(_t("PaymentForm.START", "Start"), $fields['startMonth'], $fields['startYear']);
unset($fields['startYear']);
}
if (isset($fields['expiryMonth']) && isset($fields['expiryYear'])) {
$fields['expiryMonth'] = new FieldGroup(_t("PaymentForm.EXPIRY", "Expiry"), $fields['expiryMonth'], $fields['expiryYear']);
unset($fields['expiryYear']);
}
}
return FieldList::create($fields);
}
示例3: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName('Country');
$fields->removeByName("DefaultShippingAddressID");
$fields->removeByName("DefaultBillingAddressID");
$fields->addFieldToTab('Root.Main', DropdownField::create('Country', _t('Address.db_Country', 'Country'), SiteConfig::current_site_config()->getCountriesList()));
}
示例4: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('ConfiguredScheduleID');
$interval = $fields->dataFieldByName('Interval')->setDescription('Number of seconds between each run. e.g 3600 is 1 hour');
$fields->replaceField('Interval', $interval);
$dt = new DateTime();
$fields->replaceField('StartDate', DateField::create('StartDate')->setConfig('dateformat', 'dd/MM/yyyy')->setConfig('showcalendar', true)->setDescription('DD/MM/YYYY e.g. ' . $dt->format('d/m/y')));
$fields->replaceField('EndDate', DateField::create('EndDate')->setConfig('dateformat', 'dd/MM/yyyy')->setConfig('showcalendar', true)->setDescription('DD/MM/YYYY e.g. ' . $dt->format('d/m/y')));
if ($this->ID == null) {
foreach ($fields->dataFields() as $field) {
//delete all included fields
$fields->removeByName($field->Name);
}
$rangeTypes = ClassInfo::subclassesFor('ScheduleRange');
$fields->addFieldToTab('Root.Main', TextField::create('Title', 'Title'));
$fields->addFieldToTab('Root.Main', DropdownField::create('ClassName', 'Range Type', $rangeTypes));
} else {
$fields->addFieldToTab('Root.Main', ReadonlyField::create('ClassName', 'Type'));
}
if ($this->ClassName == __CLASS__) {
$fields->removeByName('ApplicableDays');
}
return $fields;
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-schedulizer,代码行数:25,代码来源:ScheduleRange.php
示例5: SelectForm
function SelectForm()
{
$fieldList = new FieldList(NumericField::create("Year", "Manufacturing Year"), DropdownField::create("Make", "Make", array(0 => $this->pleaseSelectPhrase())), DropdownField::create("Model", "Model", array(0 => $this->pleaseSelectPhrase())), DropdownField::create("Type", "Type", array(0 => $this->pleaseSelectPhrase())), NumericField::create("ODO", "Current Odometer (overall distance travelled - as shown in your dashboard"));
$actions = new FieldList(FormAction::create("doselectform")->setTitle("Start Calculation"));
$form = Form::create($this, "SelectForm", $fieldList, $actions);
return $form;
}
示例6: ShortcodeForm
/**
* Provides a GUI for the insert/edit shortcode popup
* @return Form
**/
public function ShortcodeForm()
{
if (!Permission::check('CMS_ACCESS_CMSMain')) {
return;
}
Config::inst()->update('SSViewer', 'theme_enabled', false);
// create a list of shortcodable classes for the ShortcodeType dropdown
$classList = ClassInfo::implementorsOf('Shortcodable');
$classes = array();
foreach ($classList as $class) {
$classes[$class] = singleton($class)->singular_name();
}
// load from the currently selected ShortcodeType or Shortcode data
$classname = false;
$shortcodeData = false;
if ($shortcode = $this->request->requestVar('Shortcode')) {
$shortcode = str_replace("", '', $shortcode);
//remove BOM inside string on cursor position...
$shortcodeData = singleton('ShortcodableParser')->the_shortcodes(array(), $shortcode);
if (isset($shortcodeData[0])) {
$shortcodeData = $shortcodeData[0];
$classname = $shortcodeData['name'];
}
} else {
$classname = $this->request->requestVar('ShortcodeType');
}
if ($shortcodeData) {
$headingText = _t('Shortcodable.EDITSHORTCODE', 'Edit Shortcode');
} else {
$headingText = _t('Shortcodable.INSERTSHORTCODE', 'Insert Shortcode');
}
// essential fields
$fields = FieldList::create(array(CompositeField::create(LiteralField::create('Heading', sprintf('<h3 class="htmleditorfield-shortcodeform-heading insert">%s</h3>', $headingText)))->addExtraClass('CompositeField composite cms-content-header nolabel'), LiteralField::create('shortcodablefields', '<div class="ss-shortcodable content">'), DropdownField::create('ShortcodeType', 'ShortcodeType', $classes, $classname)->setHasEmptyDefault(true)->addExtraClass('shortcode-type')));
// attribute and object id fields
if ($classname) {
if (class_exists($classname)) {
$class = singleton($classname);
if (is_subclass_of($class, 'DataObject')) {
if (singleton($classname)->hasMethod('get_shortcodable_records')) {
$dataObjectSource = $classname::get_shortcodable_records();
} else {
$dataObjectSource = $classname::get()->map()->toArray();
}
$fields->push(DropdownField::create('id', $class->singular_name(), $dataObjectSource)->setHasEmptyDefault(true));
}
if ($attrFields = $classname::shortcode_attribute_fields()) {
$fields->push(CompositeField::create($attrFields)->addExtraClass('attributes-composite'));
}
}
}
// actions
$actions = FieldList::create(array(FormAction::create('insert', _t('Shortcodable.BUTTONINSERTSHORTCODE', 'Insert shortcode'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
// form
$form = Form::create($this, "ShortcodeForm", $fields, $actions)->loadDataFrom($this)->addExtraClass('htmleditorfield-form htmleditorfield-shortcodable cms-dialog-content');
if ($shortcodeData) {
$form->loadDataFrom($shortcodeData['atts']);
}
$this->extend('updateShortcodeForm', $form);
return $form;
}
开发者ID:helpfulrobot,项目名称:sheadawson-silverstripe-shortcodable,代码行数:64,代码来源:ShortcodableController.php
示例7: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create(HeaderField::create('Outer Captions'), $category = DropdownField::create('FeaturedWorkCategoryID', 'Category', ProjectCategory::get()->map('ID', 'Title')), $imgUploadField = UploadField::create('ProjectCoverImage', 'Cover Image'), TextareaField::create('ProjectBriefDesc', 'Hover Over Description'), TextField::create('ProjectTitle', 'Title'), HeaderField::create('Project Phases'), $imgPhase1 = UploadField::create('ProjectPhaseImg1', 'Phase 1 Image'), TextareaField::create('ProjectPhaseDesc1', 'Phase 1 Description'), $imgPhase2 = UploadField::create('ProjectPhaseImg2', 'Phase 2 Image'), TextareaField::create('ProjectPhaseDesc2', 'Phase 2 Description'), $imgPhase3 = UploadField::create('ProjectPhaseImg3', 'Phase 3 Image'), TextareaField::create('ProjectPhaseDesc3', 'Phase 3 Description'), $imgPhase4 = UploadField::create('ProjectPhaseImg4', 'Phase 4 Image'), TextareaField::create('ProjectPhaseDesc4', 'Phase 4 Description'), $imgPhase5 = UploadField::create('ProjectPhaseImg5', 'Phase 5 Image'), TextareaField::create('ProjectPhaseDesc5', 'Phase 5 Description'), $imgPhase6 = UploadField::create('ProjectPhaseImg6', 'Phase 6 Image'), TextareaField::create('ProjectPhaseDesc6', 'Phase 6 Description'));
//create inner GridField for ProjectPhases images
/*$fields->addFieldToTab('Root.Phases', GridField::create(
'ProjectPhases',
'Project Phases',
$this->ProjectPhases(),
GridFieldConfig_RecordEditor::create()
));*/
//set image upload getTempFolder
$imgUploadField->setFolderName('Featured Works Images');
//validate image upload types
$imgUploadField->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
//project phase img 1
$imgPhase1->setFolderName('Project Phase Images');
$imgPhase1->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
//project phase img 2
$imgPhase2->setFolderName('Project Phase Images');
$imgPhase2->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
//project phase img 3
$imgPhase3->setFolderName('Project Phase Images');
$imgPhase3->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
//project phase img 4
$imgPhase4->setFolderName('Project Phase Images');
$imgPhase4->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
//project phase img 5
$imgPhase5->setFolderName('Project Phase Images');
$imgPhase5->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
//project phase img 6
$imgPhase6->setFolderName('Project Phase Images');
$imgPhase6->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
//return the fields
return $fields;
}
示例8: getCMSFields
/**
* @return FieldSet
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.FormOptions', CheckboxField::create('ShowSubmittedList', 'Show the list of this user\'s submissions'));
$fields->addFieldToTab('Root.FormOptions', CheckboxField::create('ShowDraftList', 'Show the list of this user\'s draft submissions'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('AllowEditingComplete', 'Allow "Complete" submissions to be re-edited'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowSubmitButton', 'Show the submit button - if not checked, forms will be "submitted" as soon as all required fields are complete'));
$fields->addFieldToTab('Root.FormOptions', new TextField('SubmitWarning', 'A warning to display to users when the submit button is clicked'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowPreviewButton', 'Show the buttons to preview the form'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowDeleteButton', 'Show the button to delete this form submission'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowButtonsOnTop', 'Show the form action buttons above the form as well as below'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('LoadLastSubmission', 'Automatically load the latest incomplete submission when a user visits the form'));
$formFields = $this->Fields();
$options = array();
foreach ($formFields as $editableField) {
$options[$editableField->Name] = $editableField->Title;
}
$fields->addFieldToTab('Root.FormOptions', $df = DropdownField::create('SubmissionTitleField', 'Title field to use for new submissions', $options));
$df->setEmptyString('-- field --');
$df->setRightTitle('Useful if submissions are to be listed somewhere and a sort field is required');
if (class_exists('WorkflowDefinition')) {
$definitions = WorkflowDefinition::get()->map();
$field = DropdownField::create('WorkflowID', 'Submission workflow', $definitions)->setEmptyString('-- select a workflow --');
$field->setRightTitle('Workflow to use for making a submission complete');
$fields->addFieldToTab('Root.FormOptions', $field);
}
return $fields;
}
示例9: getFieldValidationOptions
public function getFieldValidationOptions()
{
$fields = parent::getFieldValidationOptions();
$validEmailFields = EditableEmailField::get()->filter(array('ParentID' => (int) $this->ParentID))->exclude(array('ID' => (int) $this->ID));
$fields->add(DropdownField::create('EqualToID', _t('EditableConfirmEmailField.EQUALTO', 'Must be equal to'), $validEmailFields->map('ID', 'Title'), $this->EqualToID)->setEmptyString('- select -'));
return $fields;
}
示例10: updateCMSFields
public function updateCMSFields(\FieldList $fields)
{
if (!$this->owner->Backend()->config()->supports_dashboard_metrics) {
return;
}
$fields->addFieldsToTab('Root.Metrics', array(\CheckboxField::create('ShowMetrics', 'Display Metrics for this environment?'), \DropdownField::create('MetricSetID', 'Metric Set', MetricSet::get()->map())));
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = $this->scaffoldFormFields(array('includeRelations' => $this->ID > 0, 'tabbed' => true, 'ajaxSafe' => true));
$types = $this->config()->get('types');
$i18nTypes = array();
foreach ($types as $key => $label) {
$i18nTypes[$key] = _t('Linkable.TYPE' . strtoupper($key), $label);
}
$fields->removeByName('SiteTreeID');
$fields->removeByName('File');
$fields->dataFieldByName('Title')->setTitle(_t('Linkable.TITLE', 'Title'))->setRightTitle(_t('Linkable.OPTIONALTITLE', 'Optional. Will be auto-generated from link if left blank'));
$fields->replaceField('Type', DropdownField::create('Type', _t('Linkable.LINKTYPE', 'Link Type'), $i18nTypes)->setEmptyString(' '), 'OpenInNewWindow');
$fields->addFieldToTab('Root.Main', DisplayLogicWrapper::create(TreeDropdownField::create('FileID', _t('Linkable.FILE', 'File'), 'File', 'ID', 'Title'))->displayIf("Type")->isEqualTo("File")->end());
$fields->addFieldToTab('Root.Main', DisplayLogicWrapper::create(TreeDropdownField::create('SiteTreeID', _t('Linkable.PAGE', 'Page'), 'SiteTree'))->displayIf("Type")->isEqualTo("SiteTree")->end());
$fields->addFieldToTab('Root.Main', $newWindow = CheckboxField::create('OpenInNewWindow', _t('Linkable.OPENINNEWWINDOW', 'Open link in a new window')));
$newWindow->displayIf('Type')->isNotEmpty();
$fields->dataFieldByName('URL')->displayIf("Type")->isEqualTo("URL");
$fields->dataFieldByName('Email')->setTitle(_t('Linkable.EMAILADDRESS', 'Email Address'))->displayIf("Type")->isEqualTo("Email");
if ($this->SiteTreeID && !$this->SiteTree()->isPublished()) {
$fields->dataFieldByName('SiteTreeID')->setRightTitle(_t('Linkable.DELETEDWARNING', 'Warning: The selected page appears to have been deleted or unpublished. This link may not appear or may be broken in the frontend'));
}
$fields->addFieldToTab('Root.Main', $anchor = TextField::create('Anchor', _t('Linkable.ANCHOR', 'Anchor')), 'OpenInNewWindow');
$anchor->setRightTitle('Include # at the start of your anchor name');
$anchor->displayIf("Type")->isEqualTo("SiteTree");
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例12: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create(TabSet::create('Root'))->text('Title')->text('Code', 'Code', '', 5)->textarea('Description')->numeric('SessionCount', 'Number of sessions')->numeric('AlternateCount', 'Number of alternates')->checkbox('VotingVisible', "This category is visible to voters")->checkbox('ChairVisible', "This category is visible to track chairs")->hidden('SummitID', 'SummitID');
if ($this->ID > 0) {
//tags
$config = new GridFieldConfig_RelationEditor(100);
$config->removeComponentsByType(new GridFieldDataColumns());
$config->removeComponentsByType(new GridFieldDetailForm());
$completer = $config->getComponentByType('GridFieldAddExistingAutocompleter');
$completer->setResultsFormat('$Tag');
$completer->setSearchFields(array('Tag'));
$completer->setSearchList(Tag::get());
$editconf = new GridFieldDetailForm();
$editconf->setFields(FieldList::create(TextField::create('Tag', 'Tag'), DropdownField::create('ManyMany[Group]', 'Group', array('topics' => 'Topics', 'speaker' => 'Speaker', 'openstack projects mentioned' => 'OpenStack Projects Mentioned'))));
$summaryfieldsconf = new GridFieldDataColumns();
$summaryfieldsconf->setDisplayFields(array('Tag' => 'Tag', 'Group' => 'Group'));
$config->addComponent($editconf);
$config->addComponent($summaryfieldsconf, new GridFieldFilterHeader());
$tags = new GridField('AllowedTags', 'Tags', $this->AllowedTags(), $config);
$fields->addFieldToTab('Root.Main', $tags);
// extra questions for call-for-presentations
$config = new GridFieldConfig_RelationEditor();
$config->removeComponentsByType('GridFieldAddNewButton');
$multi_class_selector = new GridFieldAddNewMultiClass();
$multi_class_selector->setClasses(array('TrackTextBoxQuestionTemplate' => 'TextBox', 'TrackCheckBoxQuestionTemplate' => 'CheckBox', 'TrackCheckBoxListQuestionTemplate' => 'CheckBoxList', 'TrackRadioButtonListQuestionTemplate' => 'RadioButtonList', 'TrackDropDownQuestionTemplate' => 'ComboBox', 'TrackLiteralContentQuestionTemplate' => 'Literal'));
$config->addComponent($multi_class_selector);
$questions = new GridField('ExtraQuestions', 'Track Specific Questions', $this->ExtraQuestions(), $config);
$fields->addFieldToTab('Root.Main', $questions);
}
return $fields;
}
示例13: getHTMLFragments
/**
* @param GridField $gridField
*
* @return array
*/
public function getHTMLFragments($gridField)
{
Requirements::css(CMC_BULKUPDATER_MODULE_DIR . '/css/CmcGridFieldBulkUpdater.css');
Requirements::javascript(CMC_BULKUPDATER_MODULE_DIR . '/javascript/CmcGridFieldBulkUpdater.js');
Requirements::add_i18n_javascript(CMC_BULKUPDATER_MODULE_DIR . '/lang/js');
//initialize column data
$cols = new ArrayList();
$fields = $gridField->getConfig()->getComponentByType('GridFieldEditableColumns')->getDisplayFields($gridField);
foreach ($gridField->getColumns() as $col) {
$fieldName = $col;
$fieldType = '';
$fieldLabel = '';
if (isset($fields[$fieldName])) {
$fieldData = $fields[$fieldName];
if (isset($fieldData['field'])) {
$fieldType = $fieldData['field'];
}
if (isset($fieldData['title'])) {
$fieldLabel = $fieldData['title'];
}
}
//Debug::show($fieldType);
if (class_exists($fieldType) && $fieldType != 'ReadonlyField') {
$field = new $fieldType($fieldName, $fieldLabel);
if ($fieldType == 'DatetimeField' || $fieldType == 'DateField' || $fieldType == 'TimeField') {
$field->setValue(date('Y-m-d H:i:s'));
$field->setConfig('showcalendar', true);
}
$cols->push(new ArrayData(array('UpdateField' => $field, 'Name' => $fieldName, 'Title' => $fieldLabel)));
} else {
$meta = $gridField->getColumnMetadata($col);
$cols->push(new ArrayData(array('Name' => $col, 'Title' => $meta['title'])));
}
}
$templateData = array();
if (!count($this->config['actions'])) {
user_error('Trying to use GridFieldBulkManager without any bulk action.', E_USER_ERROR);
}
//set up actions
$actionsListSource = array();
$actionsConfig = array();
foreach ($this->config['actions'] as $action => $actionData) {
$actionsListSource[$action] = $actionData['label'];
$actionsConfig[$action] = $actionData['config'];
}
reset($this->config['actions']);
$firstAction = key($this->config['actions']);
$dropDownActionsList = DropdownField::create('bulkActionName', '')->setSource($actionsListSource)->setAttribute('class', 'bulkActionName no-change-track')->setAttribute('id', '');
//initialize buttonLabel
$buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION1_BTN_LABEL', $this->config['actions'][$firstAction]['label']);
//add menu if more than one action
if (count($this->config['actions']) > 1) {
$templateData = array('Menu' => $dropDownActionsList->FieldHolder());
$buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION_BTN_LABEL', 'Go');
}
//Debug::show($buttonLabel);
$templateData = array_merge($templateData, array('Button' => array('Label' => $buttonLabel, 'Icon' => $this->config['actions'][$firstAction]['config']['icon']), 'Select' => array('Label' => _t('CMC_GRIDFIELD_BULK_UPDATER.SELECT_ALL_LABEL', 'Select all')), 'Colspan' => count($gridField->getColumns()) - 1, 'Cols' => $cols));
$templateData = new ArrayData($templateData);
return array('header' => $templateData->renderWith('CmcBulkUpdaterButtons'));
}
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', DropdownField::create('VideoID', 'Select video', EmbeddedObject::get()->map("ID", "Title")));
$fields->addFieldToTab('Root.Main', EmbeddedObjectField::create('AddVideo', 'Video from oEmbed URL'));
return $fields;
}
示例15: getCMSFields
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;
}