本文整理汇总了PHP中FieldList::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::toArray方法的具体用法?PHP FieldList::toArray怎么用?PHP FieldList::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::toArray方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>OpenStack Component</h2>"));
$fields->push(new TextField("Name", "Name"));
$fields->push(new TextField("CodeName", "Code Name"));
$fields->push(new TextField("Description", "Description"));
$fields->push(new CheckboxField('SupportsVersioning', 'Supports Versioning?'));
$fields->push(new CheckboxField('SupportsExtensions', 'Supports Extensions?'));
$fields->push(new CheckboxField('IsCoreService', 'Is Core Service?'));
$fields->push(new DropdownField('IconClass', 'Font Awesome Icon CSS Class', $this->owner->dbObject('IconClass')->enumValues()));
$fields->push(new DropdownField('Use', 'OpenStack Usage', $this->owner->dbObject('Use')->enumValues()));
if ($this->owner->getSupportsVersioning()) {
$versions_config = new GridFieldConfig_RecordEditor();
$versions = new GridField("Versions", "Versions", $this->owner->Versions(), $versions_config);
$fields->push($versions);
}
$config = new GridFieldConfig_RecordEditor();
$config->addComponent(new GridFieldSortableRows('Order'));
$related_content = new GridField("RelatedContent", "RelatedContent", $this->owner->RelatedContent(), $config);
$fields->push($related_content);
return $fields;
}
示例2: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new TextField("Title", "Title"));
$fields->push(new HtmlEditorField("Summary", "Summary"));
$fields->push(new HtmlEditorField("Description", "Description"));
$fields->push(new MemberAutoCompleteField("Curator", "Curator"));
$fields->push($ddl = new DropdownField('ReleaseID', 'Release', OpenStackRelease::get()->map("ID", "Name")));
$ddl->setEmptyString('-- Select a Release --');
if ($this->owner->ID > 0) {
$components_config = new GridFieldConfig_RelationEditor(100);
$components = new GridField("OpenStackComponents", "Supported Release Components", $this->owner->OpenStackComponents(), $components_config);
$components_config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchList($this->getAllowedComponents());
$components_config->removeComponentsByType('GridFieldAddNewButton');
//$components_config->addComponent(new GridFieldSortableRows('OpenStackSampleConfig_OpenStackComponents.Order'));
$fields->push($components);
$fields->push($ddl = new DropdownField('TypeID', 'Type', OpenStackSampleConfigurationType::get()->filter('ReleaseID', $this->owner->ReleaseID)->map("ID", "Type")));
$ddl->setEmptyString('-- Select a Configuration Type --');
$related_notes_config = new GridFieldConfig_RecordEditor(100);
$related_notes = new GridField("RelatedNotes", "Related Notes", $this->owner->RelatedNotes(), $related_notes_config);
$related_notes_config->addComponent(new GridFieldSortableRows('Order'));
$fields->push($related_notes);
}
return $fields;
}
示例3: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>Training</h2>"));
$fields->push(new TextField("Name", "Name"));
$fields->push(new HtmlEditorField("Overview", "Overview"));
$fields->push(new CheckboxField("Active", "Active"));
$types = TrainingCourseType::get();
$levels = TrainingCourseLevel::get();
$companies = Company::get();
if ($companies) {
$fields->push(new DropdownField('CompanyID', 'Company', $companies->map("ID", "Name", "Please Select a Company")));
}
if ($types && $levels && $this->owner->ID > 0) {
$config = GridFieldConfig_RecordEditor::create();
$courses = new GridField('Courses', 'Courses', $this->owner->Courses(), $config);
$fields->push($courses);
} else {
$fields->push(new LiteralField("Warning", "** You can not add any Training Course until you create some Training Course Levels and Training Course Types!."));
}
return $fields;
}
示例4: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>Support Channel Type</h2>"));
$fields->push(new TextField("Type", "Type"));
return $fields;
}
示例5: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>OpenStack Api Version</h2>"));
$fields->push(new TextField("Version", "Version"));
$fields->push(new DropdownField('Status', 'Status', $this->owner->dbObject('Status')->enumValues()));
return $fields;
}
示例6: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>MarketPlace Video Type</h2>"));
$fields->push(new TextField("Type", "Type"));
$fields->push(new TextField("Title", "Title"));
$fields->push(new TextField("Description", "Description"));
$fields->push(new TextField("MaxTotalVideoTime", "Max. Video Length (Seconds)"));
return $fields;
}
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new TextField("Type", "Type"));
$fields->push(new CheckboxField("IsDefault", "Is Default?"));
if ($this->owner->ID > 0) {
$config = new GridFieldConfig_RelationEditor(100);
$configurations = new GridField("SampleConfigurations", "Sample Configurations", $this->owner->SampleConfigurations(), $config);
$detailFormFields = new FieldList();
$detailFormFields->push(new CheckBoxField('IsDefault', 'Is Default?'));
$config->getComponentByType('GridFieldDetailForm')->setFields($detailFormFields);
$fields->push($configurations);
}
return $fields;
}
示例8: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$CountryCodes = CountryCodes::$iso_3166_countryCodes;
$fields->push(new LiteralField("Title", "<h2>Course Schedule </h2>"));
$fields->push(new TextField("City", "City"));
$fields->push(new TextField("State", "State"));
$fields->push(new DropdownField("Country", "Country", $CountryCodes));
if ($this->owner->ID > 0) {
$config = GridFieldConfig_RecordEditor::create();
$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
$times = new GridField("Times", "Times", $this->owner->Times(), $config);
$fields->push($times);
}
return $fields;
}
示例9: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new TextField("MaxInstances", "Max. Instances"));
$companies = Company::get();
if ($companies) {
$fields->push($ddl = new DropdownField('CompanyID', 'Company', $companies->map("ID", "Name")));
$ddl->setEmptyString("Please Select a Company");
}
$market_place_types = MarketPlaceType::get();
if ($market_place_types) {
$fields->push($ddl = new DropdownField('MarketPlaceTypeID', 'MarketPlaceType', $market_place_types->map("ID", "Name")));
$ddl->setEmptyString("Please Select a Market Place Type");
}
return $fields;
}
示例10: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>Training Course</h2>"));
$fields->push(new TextField("Name", "Name"));
$fields->push(new CheckboxField("Online", "Online"));
//only for online
$fields->push(new TextField("Link", "Link"));
$fields->push(new HtmlEditorField("Description", "Description", null));
$fields->push(new CheckboxField("Paid", "Is Paid"));
$levels = TrainingCourseLevel::get();
if ($levels) {
$level = new DropdownField("LevelID", "Level", TrainingCourseLevel::get()->map("ID", 'Level', '--Select Level--'));
$fields->push($level);
}
if ($this->owner->ID > 0) {
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('City' => 'City', 'State' => 'State', 'Country' => 'Country'));
$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
$schedule = new GridField("Schedules", "Schedules", $this->owner->Schedules(), $config);
$fields->push($schedule);
$config = GridFieldConfig_RelationEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Name' => 'Name'));
$config->removeComponentsByType('GridFieldAddNewButton');
$config->removeComponentsByType('GridFieldEditButton');
$projects = new GridField('Projects', 'Projects', $this->owner->Projects(), $config);
$config = GridFieldConfig_RelationEditor::create();
$config->removeComponentsByType('GridFieldAddNewButton');
$config->removeComponentsByType('GridFieldEditButton');
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Name' => 'Name'));
$prerequisite = new GridField('Prerequisites', 'Prerequisites', $this->owner->Prerequisites(), $config);
$fields->push($projects);
$fields->push($prerequisite);
}
return $fields;
}
示例11: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>Marketplace Type</h2>"));
$fields->push(new TextField("Name", "Name"));
$fields->push(new CheckboxField("Active", "Active"));
if ($this->owner->ID > 0) {
$slug_field = new TextField('Slug', 'Slug');
$slug_field->setReadonly(true);
$slug_field->setDisabled(true);
$slug_field->performReadonlyTransformation();
$fields->push($slug_field);
$group_field = new TextField('Group', 'Group', $this->owner->AdminGroup()->Title);
$group_field->setReadonly(true);
$group_field->setDisabled(true);
$group_field->performReadonlyTransformation();
$fields->push($group_field);
}
return $fields;
}
示例12: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>OpenStack Release</h2>"));
$fields->push(new TextField("Name", "Name"));
$date = DateField::create('ReleaseDate')->setConfig('showcalendar', true);
$fields->push($date);
$date->setTitle('Release Date');
$fields->push(new TextField("ReleaseNumber", "Release Number"));
$fields->push(new TextField("ReleaseNotesUrl", "Release Notes Url"));
$fields->push(new DropdownField('Status', 'Status', $this->owner->dbObject('Status')->enumValues()));
//components
if ($this->owner->ID > 0) {
$components_config = new GridFieldConfig_RelationEditor(100);
$components = new GridField("OpenStackComponents", "Supported Release Components", $this->owner->OpenStackComponents(), $components_config);
$components_config->removeComponentsByType('GridFieldAddNewButton');
$fields->push($components);
//supported versions
//only if we have components set
if ($this->owner->OpenStackComponents()->filter('SupportsVersioning', true)->count() > 0) {
$supported_versions_config = new GridFieldConfig_RecordEditor(100);
$dataColumns = $supported_versions_config->getComponentByType('GridFieldDataColumns');
$dataColumns->setDisplayFields(array('OpenStackComponent.CodeName' => 'Component CodeName', 'OpenStackComponent.Name' => 'Component Name', 'ApiVersion.Version' => 'Api Version'));
//$supported_versions_config->removeComponentsByType('GridFieldEditButton');
$supported_versions = new GridField("SupportedApiVersions", "Supported Release Components", $this->owner->SupportedApiVersions(" ReleaseID = {$this->owner->getIdentifier()} AND OpenStackComponent.SupportsVersioning = 1 ")->innerJoin('OpenStackComponent', 'OpenStackComponent.ID = OpenStackReleaseSupportedApiVersion.OpenStackComponentID'), $supported_versions_config);
$fields->push($supported_versions);
}
$config = new GridFieldConfig_RecordEditor(100);
$config_types = new GridField("SampleConfigurationTypes", "Sample Configuration Types", $this->owner->SampleConfigurationTypes(), $config);
$config->addComponent(new GridFieldSortableRows('Order'));
$fields->push($config_types);
}
return $fields;
}
示例13: updateCMSFields
public function updateCMSFields(FieldList $f)
{
//clear all fields
$oldFields = $f->toArray();
foreach ($oldFields as $field) {
$f->remove($field);
}
$_REQUEST['SummitID'] = $this->owner->ID;
$f->add($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
$summit_time_zone = null;
if ($this->owner->TimeZone) {
$time_zone_list = timezone_identifiers_list();
$summit_time_zone = $time_zone_list[$this->owner->TimeZone];
}
if ($this->owner->RandomVotingLists()->exists()) {
$f->addFieldToTab('Root.Main', HeaderField::create('The presentations in this summit have been randomised for voting', 4));
}
$f->addFieldToTab('Root.Main', new TextField('Title', 'Title'));
$f->addFieldToTab('Root.Main', $link = new TextField('Link', 'Summit Page Link'));
$link->setDescription('The link to the site page for this summit. Eg: <em>/summit/vancouver-2015/</em>');
$f->addFieldToTab('Root.Main', new CheckboxField('Active', 'This is the active summit'));
$f->addFieldToTab('Root.Main', $date_label = new TextField('DateLabel', 'Date label'));
$date_label->setDescription('A readable piece of text representing the date, e.g. <em>May 12-20, 2015</em> or <em>December 2016</em>');
$f->addFieldToTab('Root.Main', $registration_link = new TextField('RegistrationLink', 'Registration Link'));
$registration_link->setDescription('Link to the site where tickets can be purchased.');
$f->addFieldsToTab('Root.Dates', $ddl_timezone = new DropdownField('TimeZone', 'Time Zone', DateTimeZone::listIdentifiers()));
$ddl_timezone->setEmptyString('-- Select a Timezone --');
if ($summit_time_zone) {
$f->addFieldToTab('Root.Dates', new HeaderField("All dates below are in <span style='color:red;'>{$summit_time_zone}</span> time."));
} else {
$f->addFieldToTab('Root.Dates', new HeaderField("All dates below in the timezone of the summit's venue."));
}
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('SummitBeginDate', "When does the summit begin?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('SummitEndDate', "When does the summit end?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('StartShowingVenuesDate', "When do you begin showing venues?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('SubmissionBeginDate', "When do submissions begin?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('SubmissionEndDate', "When do submissions end?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('VotingBeginDate', "When does voting begin?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('VotingEndDate', "When does voting end?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('SelectionBeginDate', "When do selections begin?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('SelectionEndDate', "When do selections end?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('RegistrationBeginDate', "When does registration begin?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DatetimeField('RegistrationEndDate', "When does registration end?"));
$date->getDateField()->setConfig('showcalendar', true);
$date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldToTab('Root.Dates', $date = new DateField('ScheduleDefaultStartDate', "Default Start Date to show on schedule page?"));
$date->setConfig('showcalendar', true);
$date->setConfig('dateformat', 'dd/MM/yyyy');
$f->addFieldsToTab('Root.Main', new NumericField('MaxSubmissionAllowedPerUser', 'Max. Submission Allowed Per User'));
$logo_field = new UploadField('Logo', 'Logo');
$logo_field->setAllowedMaxFileNumber(1);
$logo_field->setAllowedFileCategories('image');
$logo_field->setFolderName('summits/logos/');
$logo_field->getValidator()->setAllowedMaxFileSize(1024 * 1024 * 1);
$f->addFieldToTab('Root.Main', $logo_field);
$f->addFieldToTab('Root.Main', new TextField('ComingSoonBtnText', 'Coming Soon Btn Text'));
$f->addFieldToTab('Root.Main', new TextField('ExternalEventId', 'Eventbrite Event Id'));
if ($this->owner->ID > 0) {
$summit_id = $this->owner->ID;
// tracks
$config = GridFieldConfig_RecordEditor::create(25);
$categories = new GridField('Categories', 'Presentation Categories', $this->owner->getCategories(), $config);
$f->addFieldToTab('Root.Presentation Categories', $categories);
$config = GridFieldConfig_RelationEditor::create(25);
$config->removeComponentsByType(new GridFieldDataColumns());
$config->removeComponentsByType(new GridFieldDetailForm());
$config->addComponent(new GridFieldUpdateDefaultCategoryTags());
$default_tags = new GridField('CategoryDefaultTags', 'Category Default Tags', $this->owner->CategoryDefaultTags(), $config);
$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());
$f->addFieldToTab('Root.Presentation Categories', $default_tags);
// track groups
//.........这里部分代码省略.........