本文整理汇总了PHP中ListboxField类的典型用法代码示例。如果您正苦于以下问题:PHP ListboxField类的具体用法?PHP ListboxField怎么用?PHP ListboxField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ListboxField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: makeListboxField
protected function makeListboxField($value)
{
$field = new ListboxField(self::FieldName, $this->getFieldLabel(), array_flip(Config::inst()->get('ArtisanHasWidthExtension', 'widths')), $value);
if ($note = $this->getFieldLabel('Note')) {
$field->setRightTitle($note);
}
return $field;
}
开发者ID:CrackerjackDigital,项目名称:artisan,代码行数:8,代码来源:ArtisanHasWidthExtension.php
示例2: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('NotificationMembers');
$fields->removeByName('CreatedByMemberID');
$fields->addFieldToTab('Root.Main', new TextField('MemberNotificationTitle', 'User notification title'));
$fields->addFieldToTab('Root.Main', new TextareaField('MemberNotificationMessage', 'User notification message (200) characters only'));
// members - many_many relation
$membersMap = Member::get()->sort('FirstName')->map('ID', 'FirstName')->toArray();
$membersField = new ListboxField('NotificationMembers', 'Select users');
$membersField->setMultiple(true)->setSource($membersMap);
$fields->addFieldToTab('Root.Main', $membersField);
return $fields;
}
开发者ID:helpfulrobot,项目名称:nadzweb-membernotification,代码行数:14,代码来源:MemberNotification.php
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
/*
* MAIN TAB
*/
$tab = 'Root.Main';
//provides listbox field menu for selecting a predefined Icon
$data = DataObject::get('Icon');
$field = new ListboxField('MyIconID', 'My Icon');
$field->setSource($data->map('ID', 'Name')->toArray());
$field->setEmptyString('Select one');
$fields->addFieldToTab($tab, $field);
return $fields;
}
开发者ID:helpfulrobot,项目名称:stephenjcorwin-silverstripe-icons,代码行数:15,代码来源:Page.php
示例4: getDefaultSearchContext
public function getDefaultSearchContext()
{
$context = parent::getDefaultSearchContext();
$fields = $context->getFields();
$fields->push(CheckboxField::create("HasBeenUsed"));
//add date range filtering
$fields->push(ToggleCompositeField::create("StartDate", "Start Date", array(DateField::create("q[StartDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[StartDateTo]", "To")->setConfig('showcalendar', true))));
$fields->push(ToggleCompositeField::create("EndDate", "End Date", array(DateField::create("q[EndDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[EndDateTo]", "To")->setConfig('showcalendar', true))));
//must be enabled in config, because some sites may have many products = slow load time, or memory maxes out
//future solution is using an ajaxified field
if (self::config()->filter_by_product) {
$fields->push(ListboxField::create("Products", "Products", Product::get()->map()->toArray())->setMultiple(true));
}
if (self::config()->filter_by_category) {
$fields->push(ListboxField::create("Categories", "Categories", ProductCategory::get()->map()->toArray())->setMultiple(true));
}
if ($field = $fields->fieldByName("Code")) {
$field->setDescription("This can be a partial match.");
}
//get the array, to maniplulate name, and fullname seperately
$filters = $context->getFilters();
$filters['StartDateFrom'] = GreaterThanOrEqualFilter::create('StartDate');
$filters['StartDateTo'] = LessThanOrEqualFilter::create('StartDate');
$filters['EndDateFrom'] = GreaterThanOrEqualFilter::create('EndDate');
$filters['EndDateTo'] = LessThanOrEqualFilter::create('EndDate');
$context->setFilters($filters);
return $context;
}
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:28,代码来源:Discount.php
示例5: getCMSFields
public function getCMSFields()
{
Requirements::css(BLOGGER_DIR . '/css/cms.css');
$self =& $this;
$this->beforeUpdateCMSFields(function ($fields) use($self) {
$fields->addFieldsToTab('Root.Main', array(HeaderField::create('Post Options', 3), $publishDate = DatetimeField::create("PublishDate", _t("BlogPost.PublishDate", "Publish Date")), ListboxField::create("Categories", _t("BlogPost.Categories", "Categories"), $self->Parent()->Categories()->map()->toArray())->setMultiple(true), ListboxField::create("Tags", _t("BlogPost.Tags", "Tags"), $self->Parent()->Tags()->map()->toArray())->setMultiple(true)));
$publishDate->getDateField()->setConfig("showcalendar", true);
// Add featured image
$fields->insertBefore($uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")), "Content");
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
});
$fields = parent::getCMSFields();
// We're going to make an SEO tab and move all the usual crap there
$menuTitle = $fields->dataFieldByName('MenuTitle');
$urlSegment = $fields->dataFieldByName('URLSegment');
$fields->addFieldsToTab('Root.SEO', array($menuTitle, $urlSegment));
$metaField = $fields->fieldByName('Root.Main.Metadata');
if ($metaField) {
$metaFields = $metaField->getChildren();
if ($metaFields->count() > 0) {
$tab = $fields->findOrMakeTab('Root.SEO');
$tab->push(HeaderField::create('Meta', 3));
foreach ($metaFields as $field) {
$tab->push($field);
}
}
$fields->removeByName('Metadata');
}
return $fields;
}
开发者ID:helpfulrobot,项目名称:micmania1-silverstripe-blog,代码行数:30,代码来源:BlogPost.php
示例6: Field
public function Field($properties = array())
{
Requirements::javascript(BOLTTOOLS_DIR . '/javascript/addnewlistboxfield.js');
$this->setTemplate('AddNewListboxField');
$this->addExtraClass('has-chzn');
return parent::Field($properties);
}
开发者ID:christopherbolt,项目名称:silverstripe-bolttools,代码行数:7,代码来源:AddNewListboxField.php
示例7: updateCMSFields
/**
*
* @param FieldList $fields
* @return void
*/
public function updateCMSFields(FieldList $fields)
{
$controller = Controller::curr();
if ($controller instanceof SecuredAssetAdmin || $controller instanceof CMSSecuredFileAddController) {
Requirements::combine_files('securedassetsadmincmsfields.js', array(SECURED_FILES_MODULE_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js', SECURED_FILES_MODULE_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.min.js', SECURED_FILES_MODULE_DIR . "/javascript/SecuredFilesLeftAndMain.js"));
Requirements::css(SECURED_FILES_MODULE_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.min.css');
Requirements::css(SECURED_FILES_MODULE_DIR . "/css/SecuredFilesLeftAndMain.css");
Requirements::javascript(SECURED_FILES_MODULE_DIR . "/javascript/SecuredFilesLeftAndMain.js");
if ($this->isFile()) {
$buttonsSecurity = $this->showButtonsSecurity();
$buttonsEmbargoExpiry = $this->showButtonsEmbargoExpiry();
// Embargo field
$embargoTypeField = new OptionSetField("EmbargoType", "", array("None" => _t('AdvancedSecuredFiles.NONENICE', "None"), "Indefinitely" => _t('AdvancedSecuredFiles.INDEFINITELYNICE', "Hide document indefinitely"), "UntilAFixedDate" => _t('AdvancedSecuredFiles.UNTILAFIXEDDATENICE', 'Hide until set date')));
$embargoUntilDateField = DatetimeField::create('EmbargoedUntilDate', '');
$embargoUntilDateField->getDateField()->setConfig('showcalendar', true)->setConfig('dateformat', 'dd-MM-yyyy')->setConfig('datavalueformat', 'dd-MM-yyyy')->setAttribute('readonly', true);
$embargoUntilDateField->getTimeField()->setAttribute('readonly', true);
// Expiry field
$expireTypeField = new OptionSetField("ExpiryType", "", array("None" => _t('AdvancedSecuredFiles.NONENICE', "None"), "AtAFixedDate" => _t('AdvancedSecuredFiles.ATAFIXEDDATENICE', 'Set file to expire on')));
$expiryDatetime = DatetimeField::create('ExpireAtDate', '');
$expiryDatetime->getDateField()->setConfig('showcalendar', true)->setConfig('dateformat', 'dd-MM-yyyy')->setConfig('datavalueformat', 'dd-MM-yyyy')->setAttribute('readonly', true);
$expiryDatetime->getTimeField()->setAttribute('readonly', true);
$securitySettingsGroup = FieldGroup::create(FieldGroup::create($embargoTypeField, $embargoUntilDateField)->addExtraClass('embargo option-change-datetime')->setName("EmbargoGroupField"), FieldGroup::create($expireTypeField, $expiryDatetime)->addExtraClass('expiry option-change-datetime')->setName("ExpiryGroupField"));
} else {
$buttonsSecurity = $this->showButtonsSecurity();
$buttonsEmbargoExpiry = '';
$securitySettingsGroup = FieldGroup::create();
}
$canViewTypeField = new OptionSetField("CanViewType", "", array("Inherit" => _t('AdvancedSecuredFiles.INHERIT', "Inherit from parent folder"), "Anyone" => _t('SiteTree.ACCESSANYONE', 'Anyone'), "LoggedInUsers" => _t('SiteTree.ACCESSLOGGEDIN', 'Logged-in users'), "OnlyTheseUsers" => _t('SiteTree.ACCESSONLYTHESE', 'Only these people (choose from list)')));
$canEditTypeField = new OptionSetField("CanEditType", "", array("Inherit" => _t('AdvancedSecuredFiles.INHERIT', "Inherit from parent folder"), "LoggedInUsers" => _t('SiteTree.ACCESSLOGGEDIN', 'Logged-in users'), "OnlyTheseUsers" => _t('SiteTree.ACCESSONLYTHESE', 'Only these people (choose from list)')));
$groupsMap = array();
foreach (Group::get() as $group) {
// Listboxfield values are escaped, use ASCII char instead of »
$groupsMap[$group->ID] = $group->getBreadcrumbs(' > ');
}
asort($groupsMap);
$viewerGroupsField = ListboxField::create("ViewerGroups", _t('AdvancedSecuredFiles.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('AdvancedSecuredFiles.GroupPlaceholder', 'Click to select group'));
$editorGroupsField = ListBoxField::create("EditorGroups", _t('AdvancedSecuredFiles.EDITORGROUPS', "Editor Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('AdvancedSecuredFiles.GroupPlaceholder', 'Click to select group'));
$securitySettingsGroup->push(FieldGroup::create($canViewTypeField, $viewerGroupsField)->addExtraClass('whocanview option-change-listbox')->setName("CanViewGroupField"));
$securitySettingsGroup->push(FieldGroup::create($canEditTypeField, $editorGroupsField)->addExtraClass('whocanedit option-change-listbox')->setName("CanEditGroupField"));
$securitySettingsGroup->setName("SecuritySettingsGroupField")->addExtraClass('security-settings');
$showAdvanced = AdvancedAssetsFilesSiteConfig::is_security_enabled() || $this->isFile() && AdvancedAssetsFilesSiteConfig::is_embargoexpiry_enabled();
if ($showAdvanced) {
$fields->insertAfter(LiteralField::create('BottomTaskSelection', $this->owner->renderWith('componentField', ArrayData::create(array('ComponentSecurity' => AdvancedAssetsFilesSiteConfig::component_cms_icon('security'), 'ComponentEmbargoExpiry' => AdvancedAssetsFilesSiteConfig::component_cms_icon('embargoexpiry'), 'ButtonsSecurity' => $buttonsSecurity, 'ButtonsEmbargoExpiry' => $buttonsEmbargoExpiry)))), "ParentID");
$fields->insertAfter($securitySettingsGroup, "BottomTaskSelection");
}
}
if (!is_a($this->owner, "Folder") && is_a($this->owner, "File")) {
$parentIDField = $fields->dataFieldByName("ParentID");
if ($controller instanceof SecuredAssetAdmin) {
$securedRoot = FileSecured::getSecuredRoot();
$parentIDField->setTreeBaseID($securedRoot->ID);
$parentIDField->setFilterFunction(create_function('$node', "return \$node->Secured == 1;"));
} else {
$parentIDField->setFilterFunction(create_function('$node', "return \$node->Secured == 0;"));
}
// SilverStripe core has a bug for search function now, so disable it for now.
$parentIDField->setShowSearch(false);
}
}
开发者ID:helpfulrobot,项目名称:deviateltd-silverstripe-advancedassets,代码行数:64,代码来源:FileSecured.php
示例8: getCMSFields
public function getCMSFields()
{
Requirements::add_i18n_javascript(BLOCKS_DIR . '/javascript/lang');
// this line is a temporary patch until I can work out why this dependency isn't being
// loaded in some cases...
if (!$this->blockManager) {
$this->blockManager = singleton('BlockManager');
}
$fields = parent::getCMSFields();
// ClassNmae - block type/class field
$classes = $this->blockManager->getBlockClasses();
$fields->addFieldToTab('Root.Main', DropdownField::create('ClassName', 'Block Type', $classes)->addExtraClass('block-type'), 'Title');
// BlockArea - display areas field if on page edit controller
if (Controller::curr()->class == 'CMSPageEditController') {
$currentPage = Controller::curr()->currentPage();
$fields->addFieldToTab('Root.Main', DropdownField::create('ManyMany[BlockArea]', 'BlockArea', $this->blockManager->getAreasForPageType($currentPage->ClassName))->setHasEmptyDefault(true)->setRightTitle($currentPage->areasPreviewButton()), 'ClassName');
}
$fields->removeFieldFromTab('Root', 'BlockSets');
$fields->removeFieldFromTab('Root', 'Pages');
// legacy fields, will be removed in later release
$fields->removeByName('Weight');
$fields->removeByName('Area');
$fields->removeByName('Published');
if ($this->blockManager->getUseExtraCSSClasses()) {
$fields->addFieldToTab('Root.Main', $fields->dataFieldByName('ExtraCSSClasses'), 'Title');
} else {
$fields->removeByName('ExtraCSSClasses');
}
// Viewer groups
$fields->removeFieldFromTab('Root', 'ViewerGroups');
$groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
asort($groupsMap);
$viewersOptionsField = new OptionsetField("CanViewType", _t('SiteTree.ACCESSHEADER', "Who can view this page?"));
$viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group'));
$viewersOptionsSource = array();
$viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
$viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
$viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
$viewersOptionsField->setSource($viewersOptionsSource)->setValue("Anyone");
$fields->addFieldsToTab('Root.ViewerGroups', array($viewersOptionsField, $viewerGroupsField));
// Disabled for now, until we can list ALL pages this block is applied to (inc via sets)
// As otherwise it could be misleading
// Show a GridField (list only) with pages which this block is used on
// $fields->removeFieldFromTab('Root.Pages', 'Pages');
// $fields->addFieldsToTab('Root.Pages',
// new GridField(
// 'Pages',
// 'Used on pages',
// $this->Pages(),
// $gconf = GridFieldConfig_Base::create()));
// enhance gridfield with edit links to pages if GFEditSiteTreeItemButtons is available
// a GFRecordEditor (default) combined with BetterButtons already gives the possibility to
// edit versioned records (Pages), but STbutton loads them in their own interface instead
// of GFdetailform
// if(class_exists('GridFieldEditSiteTreeItemButton')){
// $gconf->addComponent(new GridFieldEditSiteTreeItemButton());
// }
return $fields;
}
开发者ID:mhssmnn,项目名称:silverstripe-blocks,代码行数:59,代码来源:Block.php
示例9: updateSearchForm
/**
* Update the page filtering, allowing CMS searchable content tagging.
*/
public function updateSearchForm($form)
{
// Update the page filtering, allowing multiple tags.
Requirements::javascript(FUSION_PATH . '/javascript/fusion.js');
// Instantiate a field containing the existing tags.
$form->Fields()->insertBefore(ListboxField::create('q[Tagging]', 'Tags', FusionTag::get()->map('Title', 'Title')->toArray(), ($filtering = $this->owner->getRequest()->getVar('q')) && isset($filtering['Tagging']) ? $filtering['Tagging'] : array(), null, true), 'q[Term]');
// Allow extension.
$this->owner->extend('updateCMSMainTaggingExtensionSearchForm', $form);
}
开发者ID:nglasl,项目名称:silverstripe-fusion,代码行数:12,代码来源:CMSMainTaggingExtension.php
示例10: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$localesNames = Fluent::locale_names();
if (!$this->owner instanceof SiteConfig) {
// If the ActiveLocales has been applied to SiteConfig, restrict locales to allowed ones
$conf = SiteConfig::current_site_config();
if ($conf->hasExtension('ActiveLocalesExtension') && $conf->ActiveLocales) {
$localesNames = $conf->ActiveLocalesNames();
}
}
// Avoid clutter if we only have one locale anyway
if (count($localesNames) === 1) {
return;
}
$fields->addFieldToTab('Root.Main', $lang = new ListboxField('ActiveLocales', _t('ActiveLocalesExtension.ACTIVELOCALE', 'Active Languages'), $localesNames));
$lang->setMultiple(true);
return $fields;
}
开发者ID:lekoala,项目名称:silverstripe-devtoolkit,代码行数:18,代码来源:ActiveLocalesExtension.php
示例11: updateCMSFields
/**
* Adds variations specific fields to the CMS.
*/
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldsToTab('Root.Variations', array(ListboxField::create("VariationAttributeTypes", _t('ProductVariationsExtension.ATTRIBUTES', "Attributes"), ProductAttributeType::get()->map("ID", "Title")->toArray())->setMultiple(true)->setDescription(_t('ProductVariationsExtension.ATTRIBUTES_DESCRIPTION', "These are fields to indicate the way(s) each variation varies. Once selected, they can be edited on each variation.")), GridField::create("Variations", _t('ProductVariationsExtension.VARIATIONS', "Variations"), $this->owner->Variations(), GridFieldConfig_RecordEditor::create())));
if ($this->owner->Variations()->exists()) {
$fields->addFieldToTab('Root.Pricing', LabelField::create('variationspriceinstructinos', _t('ProductVariationsExtension.VARIATIONS_INSTRUCTIONS', "Price - Because you have one or more variations, the price can be set in the \"Variations\" tab.")));
$fields->removeFieldFromTab('Root.Pricing', 'BasePrice');
$fields->removeFieldFromTab('Root.Pricing', 'CostPrice');
$fields->removeFieldFromTab('Root.Main', 'InternalItemID');
}
}
开发者ID:NobrainerWeb,项目名称:silverstripe-shop,代码行数:13,代码来源:ProductVariationsExtension.php
示例12: updateCMSFields
public function updateCMSFields($fields)
{
$topLevelGroups = Group::get()->filter('ParentID', 0)->map()->toArray();
$groups = ListboxField::create('LoggedInGroups', 'Groups representing logged in users', $topLevelGroups);
$groups->setMultiple(true);
$fields->addFieldToTab('Root.MicroBlogSettings', $groups);
$allGroups = Group::get()->map()->toArray();
$groups = ListboxField::create('TargetedGroups', 'Groups users can selectively post to', $allGroups);
$groups->setMultiple(true);
$fields->addFieldToTab('Root.MicroBlogSettings', $groups);
}
开发者ID:helpfulrobot,项目名称:silverstripe-microblog,代码行数:11,代码来源:MicroBlogSystemSettings.php
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$metricsMap = array();
foreach (Metric::get() as $metric) {
$metricsMap[$metric->ID] = $metric->Name;
}
$metricsField = \ListboxField::create('Metrics', 'Metrics')->setMultiple(true)->setSource($metricsMap);
$fields->addFieldToTab('Root.Main', $metricsField);
return $fields;
}
开发者ID:silverstripeltd,项目名称:deploynaut-metrics,代码行数:11,代码来源:MetricSet.php
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('FaqPageID');
$fields->removeByName('FaqTags');
$fields->removeByName('SortOrder');
$fields->addFieldToTab('Root.Main', new TextField('Question', 'Question'));
$fields->addFieldToTab('Root.Main', new HtmlEditorField('Answer', 'Answer'));
// faq section - has_one relation
$map = FaqSection::get()->sort('Title')->map('ID', 'Title');
$field = new DropdownField('FaqSectionID', 'Faq section', $map);
$field->setEmptyString('None');
$fields->addFieldToTab('Root.Main', $field, 'Question');
// faq tags - has_many relation
$tagMap = FaqTag::get()->sort('Title')->map('ID', 'Title')->toArray();
$tagsField = new ListboxField('FaqTags', 'Faq tags');
$tagsField->setMultiple(true)->setSource($tagMap);
$fields->addFieldToTab('Root.Main', $tagsField, 'Question');
return $fields;
}
开发者ID:helpfulrobot,项目名称:nadzweb-advancedfaq,代码行数:20,代码来源:Faq.php
示例15: getCMSFields
/**
* Display the appropriate CMS media page fields and respective media type attributes.
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Display the media type as read only.
$fields->addFieldToTab('Root.Main', ReadonlyField::create('Type', 'Type', $this->MediaType()->Title), 'Title');
// Display a notification that the parent holder contains mixed children.
$parent = $this->getParent();
if ($parent && $parent->getMediaHolderChildren()->exists()) {
Requirements::css(MEDIAWESOME_PATH . '/css/mediawesome.css');
$fields->addFieldToTab('Root.Main', LiteralField::create('MediaNotification', "<p class='mediawesome notification'><strong>Mixed {$this->MediaType()->Title} Holder</strong></p>"), 'Type');
}
// Display the remaining media page fields.
$fields->addFieldToTab('Root.Main', TextField::create('ExternalLink')->setRightTitle('An <strong>optional</strong> redirect URL to the media source'), 'URLSegment');
$fields->addFieldToTab('Root.Main', $date = DatetimeField::create('Date'), 'Content');
$date->getDateField()->setConfig('showcalendar', true);
// Allow customisation of categories and tags respective to the current page.
$tags = MediaTag::get()->map()->toArray();
$fields->findOrMakeTab('Root.CategoriesTags', 'Categories and Tags');
$fields->addFieldToTab('Root.CategoriesTags', $categoriesList = ListboxField::create('Categories', 'Categories', $tags)->setMultiple(true));
$fields->addFieldToTab('Root.CategoriesTags', $tagsList = ListboxField::create('Tags', 'Tags', $tags)->setMultiple(true));
if (!$tags) {
$categoriesList->setAttribute('disabled', 'true');
$tagsList->setAttribute('disabled', 'true');
}
// Allow customisation of media type attribute content respective to the current page.
if ($this->MediaAttributes()->exists()) {
foreach ($this->MediaAttributes() as $attribute) {
if (strripos($attribute->Title, 'Time') || strripos($attribute->Title, 'Date') || stripos($attribute->Title, 'When')) {
// Display an attribute as a date time field where appropriate.
$fields->addFieldToTab('Root.Main', $custom = DatetimeField::create("{$attribute->ID}_MediaAttribute", $attribute->Title, $attribute->Content), 'Content');
$custom->getDateField()->setConfig('showcalendar', true);
} else {
$fields->addFieldToTab('Root.Main', $custom = TextField::create("{$attribute->ID}_MediaAttribute", $attribute->Title, $attribute->Content), 'Content');
}
$custom->setRightTitle('Custom <strong>' . strtolower($this->MediaType()->Title) . '</strong> attribute');
}
}
// Display an abstract field for content summarisation.
$fields->addfieldToTab('Root.Main', $abstract = TextareaField::create('Abstract'), 'Content');
$abstract->setRightTitle('A concise summary of the content');
$abstract->setRows(6);
// Allow customisation of images and attachments.
$type = strtolower($this->MediaType()->Title);
$fields->findOrMakeTab('Root.ImagesAttachments', 'Images and Attachments');
$fields->addFieldToTab('Root.ImagesAttachments', $images = UploadField::create('Images'));
$images->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif', 'bmp'));
$images->setFolderName("media-{$type}/{$this->ID}/images");
$fields->addFieldToTab('Root.ImagesAttachments', $attachments = UploadField::create('Attachments'));
$attachments->setFolderName("media-{$type}/{$this->ID}/attachments");
// Allow extension customisation.
$this->extend('updateMediaPageCMSFields', $fields);
return $fields;
}
开发者ID:helpfulrobot,项目名称:nglasl-silverstripe-mediawesome,代码行数:56,代码来源:MediaPage.php
示例16: getSettingsFields
public function getSettingsFields()
{
$fields = parent::getSettingsFields();
$groupsMap = array();
foreach (Group::get() as $group) {
// Listboxfield values are escaped, use ASCII char instead of »
$groupsMap[$group->ID] = $group->getBreadcrumbs(' > ');
}
asort($groupsMap);
$fields->addFieldToTab("Root.Settings", ListboxField::create("PosterGroups", _t("Discussion.PosterGroups", "Groups that can post"))->setMultiple(true)->setSource($groupsMap)->setValue(null, $this->PosterGroups()), "CanViewType");
$fields->addFieldToTab("Root.Settings", ListboxField::create("ModeratorGroups", _t("Discussion.ModeratorGroups", "Groups that can moderate"))->setMultiple(true)->setSource($groupsMap)->setValue(null, $this->ModeratorGroups()), "CanViewType");
return $fields;
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-discussions,代码行数:13,代码来源:DiscussionHolder.php
示例17: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$services = SiteConfig::config()->available_services;
if (!$services) {
$services = array_keys(self::listAvailableMediaServices());
}
if (in_array('twitter', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('TwitterUsername', _t('Socialstream.TwitterUsername', 'Twitter Username')));
}
if (in_array('twitter_hashtag', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('TwitterHashtag', _t('Socialstream.TwitterHashtag', 'Twitter Hashtag')));
}
if (in_array('facebook_page', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('FacebookPage', _t('Socialstream.FacebookPage', 'Facebook Page')));
}
if (in_array('vimeo', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('VimeoUsername', _t('Socialstream.VimeoUsername', 'Vimeo Username')));
}
if (in_array('youtube', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('YoutubeUsername', _t('Socialstream.YoutubeUsername', 'Youtube Username')));
}
if (in_array('dailymotion', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('DailymotionUsername', _t('Socialstream.DailymotionUsername', 'Dailymotion Username')));
}
if (in_array('rss', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('RssFeed', _t('Socialstream.RssFeed', 'Rss Feed')));
}
if (in_array('flickr', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('FlickrUsername', _t('Socialstream.FlickrUsername', 'Flickr Username')));
}
if (in_array('github', $services)) {
$fields->addFieldToTab('Root.Social', new TextField('GithubUsername', _t('Socialstream.GithubUsername', 'Github Username')));
}
$fields->addFieldToTab('Root.Social', $wl = new ListboxField('LifestreamWhitelist', _t('Socialstream.LifestreamWhitelist', 'Lifestream Whitelist'), array_combine($services, $services)));
$wl->setMultiple(true);
$wl->setDescription('A list of services to display on the Lifestream. If left blank, all configured streams will be used.');
$fields->addFieldToTab('Root.Social', new NumericField('LifestreamItems', _t('Socialstream.LifestreamItems', 'Lifestream Items')));
return $fields;
}
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-socialstream,代码行数:39,代码来源:SocialstreamSiteConfig.php
示例18: getCMSFields
/**
* getCMSFields
* @return FieldList
**/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->dataFieldByName('Title')->setTitle('Article Title');
$fields->dataFieldByName('Content')->setTitle('Article Content');
$config = $this->config();
// publish date
$fields->addFieldToTab('Root.Main', DateField::create('PublishDate')->setAttribute('placeholder', $this->dbObject('Created')->Format('M d, Y')), 'Content');
// tags
if ($config->enable_tags) {
$tagSource = function () {
return NewsTag::get()->map()->toArray();
};
$fields->addFieldToTab('Root.Main', ListboxField::create('Tags', 'Tags', $tagSource(), null, null, true)->useAddnew('NewsTag', $tagSource), 'Content');
}
// author
if ($config->author_mode == 'string') {
$fields->addFieldToTab('Root.Main', TextField::create('Author', 'Author'), 'Content');
}
if ($config->author_mode == 'object') {
$authorSource = function () {
return NewsAuthor::get()->map('ID', 'Name')->toArray();
};
$fields->addFieldToTab('Root.Main', DropdownField::create('NewsAuthorID', 'Author', $authorSource())->useAddNew('NewsAuthor', $authorSource)->setHasEmptyDefault(true), 'Content');
}
// featured
if ($config->enable_featured_articles) {
$fields->addFieldToTab('Root.Main', CheckboxField::create('Featured', _t('NewsArticle.FEATURED', 'Feature this article')), 'Content');
}
// images
if ($config->enable_images) {
$fields->addFieldToTab('Root.FilesAndImages', UploadField::create('Image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setFolderName($config->get('image_folder')));
}
// attachments
if ($config->enable_attachments) {
$fields->addFieldToTab('Root.FilesAndImages', UploadField::create('Attachment')->setAllowedFileCategories('doc')->setAllowedMaxFileNumber(1)->setFolderName($config->get('attachment_folder')));
}
// summary
if ($config->enable_summary) {
$fields->addFieldToTab('Root.Main', HTMLEditorField::create('Summary', 'Article Summary'), 'Content');
}
// parent
$holders = NewsHolder::get();
if ($holders->count() > 1) {
$fields->addFieldToTab('Root.Main', DropdownField::create('ParentID', 'News Section', $holders->map()->toArray()), 'Title');
} else {
$fields->addFieldToTab('Root.Main', HiddenField::create('ParentID', 'News Section', $holders->first()->ID), 'Title');
}
$this->extend('updateArticleCMSFields', $fields);
return $fields;
}
开发者ID:nyeholt,项目名称:silverstripe-newsly,代码行数:55,代码来源:NewsArticle.php
示例19: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$categories = function () {
//TODO: This should only be the case for public events
return PublicEventCategory::get()->map()->toArray();
};
$categoriesField = ListboxField::create('Categories', 'Categories')->setMultiple(true)->setSource($categories());
//If the quickaddnew module is installed, use it to allow
//for easy adding of categories
if (class_exists('QuickAddNewExtension')) {
$categoriesField->useAddNew('PublicEventCategory', $categories);
}
$fields->addFieldToTab('Root.Main', $categoriesField);
}
开发者ID:andrewandante,项目名称:silverstripe-calendar,代码行数:14,代码来源:EventCategoryExtention.php
示例20: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Order');
$fields->removeByName('ProcessInfo');
$fields->removeByName('StopStageID');
$fields->removeByName('StopButton');
$fields->removeByName('ContinueButton');
$fields->removeByName('DecisionPoint');
$fields->removeByName('CaseFinal');
$fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
<span class="step-label">
<span class="flyout">3</span><span class="arrow"></span>
<span class="title">Stage Settings</span>
</span>
</h3>'), 'Title');
$caseFinalMap = ProcessCase::get()->filter(array('ParentProcessID' => $this->ParentID))->map("ID", "Title")->toArray();
asort($caseFinalMap);
$case = ListboxField::create('CaseFinal', 'Final step for these Cases')->setMultiple(true)->setSource($caseFinalMap)->setAttribute('data-placeholder', _t('ProcessAdmin.Cases', 'Cases', 'Placeholder text for a dropdown'));
$fields->insertAfter($case, 'Title');
$fields->insertAfter($group = new CompositeField($label = new LabelField('switchLabel', 'Act as Decision Point'), new CheckboxField('DecisionPoint', '')), 'ParentID');
$group->addExtraClass("field special process-noborder");
$label->addExtraClass("left");
$fields->dataFieldByName('Content')->setRows(10);
if ($this->ID > 0) {
$fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p></p>'));
$fields->addFieldToTab('Root.Main', $processInfo = new CompositeField($grid = new GridField('ProcessInfo', 'Information for this stage', $this->ProcessInfo()->sort(array('TypeID' => 'ASC', 'ProcessCaseID' => 'ASC', 'LinksToAnotherStageID' => 'ASC')), $gridConfig = GridFieldConfig_RelationEditor::create())));
$gridConfig->addComponent(new GridFieldSortableRows('Order'));
$processInfo->addExtraClass('process-spacing');
$grid->addExtraClass('toggle-grid');
} else {
$fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p class="message info">Save this stage to add info</p>'));
}
$fields->insertBefore(new LiteralField('StageTitleInfo', '<h3 class="process-info-header">
<span class="step-label">
<span class="flyout">4</span><span class="arrow"></span>
<span class="title">Information</span>
</span>
</h3>'), 'SaveRecord');
$stopStage = ProcessStopStage::get();
if ($stopStage) {
$fields->insertBefore($inner = new CompositeField(new LiteralField('Decision', '<h3>Decision Point</h3>'), new LiteralField('ExplainStop', '<label class="right">Choose a stop stage if you would like this stage to act as a decision point</label>'), $stop = new DropdownField('StopStageID', 'Stop Stage', $stopStage->map('ID', 'Title')), $continue = new TextField('ContinueButton', 'Button: Continue (e.g. "Yes")'), new TextField('StopButton', 'Button: Stop (e.g. "No")')), 'ProcessInfo');
$stop->setEmptyString('No stop after this stage');
$inner->addExtraClass('message special toggle-decide');
$continue->addExtraClass('process-noborder');
$stop->addExtraClass('process-noborder');
}
return $fields;
}
开发 |
请发表评论