本文整理汇总了PHP中TreeDropdownField::create方法的典型用法代码示例。如果您正苦于以下问题:PHP TreeDropdownField::create方法的具体用法?PHP TreeDropdownField::create怎么用?PHP TreeDropdownField::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeDropdownField
的用法示例。
在下文中一共展示了TreeDropdownField::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
/**
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', TreeDropdownField::create('FolderID', _t('EditableUploadField.SELECTUPLOADFOLDER', 'Select upload folder'), 'Folder'));
$fields->addFieldToTab("Root.Main", new LiteralField("FileUploadWarning", "<p class=\"message notice\">" . _t("UserDefinedForm.FileUploadWarning", "Files uploaded through this field could be publicly accessible if the exact URL is known") . "</p>"), "Type");
return $fields;
}
示例2: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Remove fields
$fields->removeByName(array('Unique', 'Permanent', 'CanClose', 'CloseColor', 'LinkID'));
// Add fields
// Main tab
$fields->addFieldToTab("Root.Main", $test = TextField::create("ButtonText")->setTitle(_t("SiteMessage.LABELBUTTONTEXT", "Button Text")));
$fields->addFieldToTab("Root.Main", TreeDropdownField::create("PageID")->setTitle(_t("SiteMessage.LABELLINKTO", "Link to"))->setSourceObject("SiteTree"));
$fields->addFieldToTab("Root.Main", HTMLEditorField::create("Content")->setTitle(_t("SiteMessage.LABELCONTENT", "Message content"))->setRows(15));
// Design tab
$fields->addFieldToTab("Root.Design", HeaderField::create("ColorSettings")->setTitle(_t("SiteMessage.HEADERCOLORSETTINGS", "Color settings")));
$fields->addFieldToTab("Root.Design", ColorField::create("BackgroundColor")->setTitle(_t("SiteMessage.LABELBACKGROUNDCOLOR", "Background Color")));
$fields->addFieldToTab("Root.Design", ColorField::create("TextColor")->setTitle(_t("SiteMessage.LABELTEXTCOLOR", "Text Color")));
$fields->addFieldToTab("Root.Design", ColorField::create("ButtonColor")->setTitle(_t("SiteMessage.LABELBUTTONCOLOR", "Button Color")));
$fields->addFieldToTab("Root.Design", ColorField::create("ButtonTextColor")->setTitle(_t("SiteMessage.LABELBUTTONTEXTCOLOR", "Button Text Color")));
$fields->addFieldToTab("Root.Design", HeaderField::create("CloseSettings")->setTitle(_t("SiteMessage.HEADERCLOSESETTINGS", "Close button settings")));
$fields->addFieldToTab("Root.Design", FieldGroup::create(_t("SiteMessage.LABELCANCLOSE", "Show close button?"), Checkboxfield::create("CanClose", "")));
$fields->addFieldToTab("Root.Design", ColorField::create("CloseColor")->setTitle(_t("SiteMessage.LABELCLOSECOLOR", "Close button color")));
// Schedule tab
$fields->addFieldToTab("Root.Schedule", FieldGroup::create(_t("SiteMessage.LABELPERMANENT", "Is this message permanent?"), CheckboxField::create("Permanent", "")));
$fields->addFieldToTab("Root.Schedule", $Start = new DatetimeField("Start"));
$fields->addFieldToTab("Root.Schedule", $End = new DatetimeField("End"));
$Start->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "Start Date"))->getDateField('Start')->setConfig('showcalendar', TRUE);
$End->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "End Date"))->getDateField('End')->setConfig('showcalendar', TRUE);
return $fields;
}
示例3: ConvertObjectForm
/**
* Form used for defining the conversion form
* @return {Form} Form to be used for configuring the conversion
*/
public function ConvertObjectForm()
{
//Reset the reading stage
Versioned::reset();
$fields = new FieldList(CompositeField::create($convertModeField = new OptionsetField('ConvertMode', '', array('ReplacePage' => _t('KapostAdmin.REPLACES_AN_EXISTING_PAGE', '_This replaces an existing page'), 'NewPage' => _t('KapostAdmin.IS_NEW_PAGE', '_This is a new page')), 'NewPage'))->addExtraClass('kapostConvertLeftSide'), CompositeField::create($replacePageField = TreeDropdownField::create('ReplacePageID', _t('KapostAdmin.REPLACE_PAGE', '_Replace this page'), 'SiteTree')->addExtraClass('replace-page-id'), TreeDropdownField::create('ParentPageID', _t('KapostAdmin.USE_AS_PARENT', '_Use this page as the parent for the new page, leave empty for a top level page'), 'SiteTree')->addExtraClass('parent-page-id'))->addExtraClass('kapostConvertRightSide'));
$actions = new FieldList(FormAction::create('doConvertObject', _t('KapostAdmin.CONTINUE_CONVERT', '_Continue'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'kapost-convert'));
$validator = new RequiredFields('ConvertMode');
$form = new Form($this, 'ConvertObjectForm', $fields, $actions, $validator);
$form->addExtraClass('KapostAdmin center')->setAttribute('data-layout-type', 'border')->setTemplate('KapostAdmin_ConvertForm');
//Handle pages to see if the page exists
$convertToClass = $this->getDestinationClass();
if ($convertToClass !== false && ($convertToClass == 'SiteTree' || is_subclass_of($convertToClass, 'SiteTree'))) {
$obj = SiteTree::get()->filter('KapostRefID', Convert::raw2sql($this->record->KapostRefID))->first();
if (!empty($obj) && $obj !== false && $obj->ID > 0) {
$convertModeField->setValue('ReplacePage');
$replacePageField->setValue($obj->ID);
$recordTitle = $this->record->Title;
if (!empty($recordTitle) && $recordTitle != $obj->Title) {
$urlFieldLabel = _t('KapostAdmin.TITLE_CHANGE_DETECT', '_The title differs from the page being replaced, it was "{wastitle}" and will be changed to "{newtitle}". Do you want to update the URL Segment?', array('wastitle' => $obj->Title, 'newtitle' => $recordTitle));
$fields->push(CheckboxField::create('UpdateURLSegment', $urlFieldLabel)->addExtraClass('urlsegmentcheck')->setAttribute('data-replace-id', $obj->ID)->setForm($form)->setDescription(_t('KapostAdmin.NEW_URL_SEGMENT', '_The new URL Segment will be or will be close to "{newsegment}"', array('newsegment' => $obj->generateURLSegment($recordTitle)))));
}
}
}
Requirements::css(KAPOST_DIR . '/css/KapostAdmin.css');
Requirements::add_i18n_javascript(KAPOST_DIR . '/javascript/lang/');
Requirements::javascript(KAPOST_DIR . '/javascript/KapostAdmin_convertPopup.js');
//Allow extensions to adjust the form
$this->extend('updateConvertObjectForm', $form, $this->record);
return $form;
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-kapost-bridge,代码行数:34,代码来源:KapostGridFieldDetailForm_ItemRequest.php
示例4: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->insertBefore($shoptab = new Tab('Shop', 'Shop'), 'Access');
$fields->addFieldsToTab("Root.Shop", new TabSet("ShopTabs", $maintab = new Tab("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = new Tab("Countries", CheckboxSetField::create('AllowedCountries', 'Allowed Ordering and Shipping Countries', self::config()->iso_3166_country_codes))));
$fields->removeByName("CreateTopLevelGroups");
$countriestab->setTitle("Allowed Countries");
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldsFromTab('Root.Main', array('SortOrder', 'MenuID', 'Title'));
$fields->replaceField('PageID', TreeDropdownField::create("PageID", "Choose a page:", "SiteTree"));
return $fields;
}
示例6: 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;
}
示例7: getCMSFields
/**
* Get CMS fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldsFromTab('Root.Main', array('Title', 'SortOrder', 'FeaturedWorkParentID'));
$fields->replaceField('WorkID', TreeDropdownField::create('WorkID', 'Work', 'SiteTree'));
return $fields;
}
示例8: getCMSFields
public function getCMSFields()
{
$this->beforeExtending('updateCMSFields', function (FieldList $fields) {
$fields->removeByName('PageID');
$fields->replaceField('Username', TreeDropdownField::create('PageID', _t('SocialFeed.DISPLAY_CHILDREN_OF_PAGE', 'Display children of'), 'Page'));
});
return parent::getCMSFields();
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
if ($checkouts = CheckoutPage::get()) {
$fields->addFieldToTab('Root.Links', DropdownField::create('CheckoutPageID', _t('CartPage.has_one_CheckoutPage', 'Checkout Page'), $checkouts->map("ID", "Title")));
}
$fields->addFieldToTab('Root.Links', TreeDropdownField::create('ContinuePageID', _t('CartPage.has_one_ContinuePage', 'Continue Shopping Page'), 'SiteTree'));
return $fields;
}
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), HtmlEditorField::create('Summary')->setDescription('Short summary to show on hover')->setRows(5), HtmlEditorField::create('Content')->setDescription('Content of help article'), TreeDropdownField::create('ParentID', 'Parent', 'AdminHelp', 'ID', 'Title')));
if ($childrenGrid = $fields->fieldByName('Root.Children.Children')) {
$childrenGrid->getConfig()->addComponent(GridFieldOrderableRows::create('Sort'));
}
return $fields;
}
示例11: getCMSFields
/**
* Get CMS fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldsFromTab('Root.Main', array('CarouselParentID', 'SortOrder'));
$fields->replaceField('Title', TextField::create('Title', 'Title'));
$fields->dataFieldByName('Image')->setFolderName('Carousels');
$fields->replaceField('RedirectPageID', TreeDropdownField::create('RedirectPageID', 'Choose a redirect page', 'SiteTree'));
return $fields;
}
示例12: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.CheckboxSet", new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
$fields->addFieldsToTab('Root.Tree', array(TreeDropdownField::create('HasOnePage', 'HasOnePage', 'SiteTree'), TreeMultiselectField::create('HasManyPages', 'HasManyPages', 'SiteTree'), TreeMultiselectField::create('ManyManyPages', 'ManyManyPages (with search)', 'SiteTree')->setShowSearch(true)));
// $fields->addFieldToTab("Root.Tests.ComplexTableField",
// new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
// $fields->addFieldToTab("Root.Tests.CheckboxSet", new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
return $fields;
}
示例13: getConfiguration
public function getConfiguration()
{
$fields = parent::getConfiguration();
$fields->push(TreeDropdownField::create("ParentID", "Section", "SiteTree")->setFilterFunction(function ($node) {
return SiteTree::get()->filter("ParentID", $node->ID)->exists();
}));
$fields->push(DropdownField::create("Subject", "Page type", $this->getPageTypes())->addExtraClass("no-chzn"));
$fields->push(TextField::create("Count", _t('DashboardRecentEdits.COUNT', 'Number of pages to display')));
return $fields;
}
示例14: getCMSFields
/**
* CMS Fields
* @return array
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$TeaserConfig = GridFieldConfig_RecordEditor::create();
if ($this->LinkList()->Count() > 0) {
$TeaserConfig->addComponent(new GridFieldOrderableRows());
}
$fields->addFieldsToTab('Root.Main', array(TextareaField::create('Title')->setRows(1), DropdownField::create('LinkType', 'Type', array("currentchildren" => "List all sub pages of this page", "children" => "Specify a page and list all its sub pages", "specify" => "Specify each link")), DisplayLogicWrapper::create(TreeDropdownField::create('ParentPageID', 'Select a page', 'SiteTree'))->displayIf("LinkType")->isEqualTo("children")->end(), DisplayLogicWrapper::create(GridField::create('LinkList', 'Current Link(s)', $this->LinkList(), $TeaserConfig))->displayIf("LinkType")->isEqualTo("specify")->end()));
return $fields;
}
示例15: getCMSFields
public function getCMSFields()
{
$this->beforeUpdateCMSFields(function ($fields) {
$url = TextField::create('LinkURL', 'Link URL');
$url->setRightTitle('Including protocol e.g: ' . Director::absoluteBaseURL());
$fields->addFieldToTab('Root.Main', $url);
$fields->addFieldsToTab('Root.Main', array(TreeDropdownField::create('InternalLinkID', 'Link To', 'SiteTree'), CheckboxField::create('NewWindow', 'Open in a new window'), $text = TextField::create('LinkText', 'Link Text'), $desc = TextareaField::create('LinkDescription', 'Link Description')));
});
return parent::getCMSFields();
}