本文整理汇总了PHP中HeaderField::create方法的典型用法代码示例。如果您正苦于以下问题:PHP HeaderField::create方法的具体用法?PHP HeaderField::create怎么用?PHP HeaderField::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeaderField
的用法示例。
在下文中一共展示了HeaderField::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
/**
* getCMSFields
* Construct the FieldList used in the CMS. To provide a
* smarter UI we don't use the scaffolding provided by
* parent::getCMSFields.
*
* @return FieldList
*/
public function getCMSFields()
{
Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
//Create the FieldList and push the Root TabSet on to it.
$fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Order Status"), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("The name of your custom order status. i.e. Pending, Awaiting Stock."), TextareaField::create("Content", "Friendly Description")->setRightTitle("This will be shown to your customers. What do you wish to tell them about this status?")))));
return $fields;
}
示例2: AddNewListboxForm
public function AddNewListboxForm()
{
$action = FormAction::create('doSave', 'Save')->setUseButtonTag('true');
if (!$this->isFrontend) {
$action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept');
}
$model = $this->getModel();
$link = singleton($model);
$fields = $link->getCMSFields();
$title = $this->getDialogTitle() ? $this->getDialogTitle() : 'New Item';
$fields->insertBefore(HeaderField::create('AddNewHeader', $title), $fields->first()->getName());
$actions = FieldList::create($action);
$form = Form::create($this, 'AddNewListboxForm', $fields, $actions);
$fields->push(HiddenField::create('model', 'model', $model));
/*
if($link){
$form->loadDataFrom($link);
$fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID));
}
// Chris Bolt, fixed this
//$this->owner->extend('updateLinkForm', $form);
$this->extend('updateLinkForm', $form);
// End Chris Bolt
*/
return $form;
}
示例3: getCMSFields
public function getCMSFields()
{
$DefaultAlbumCoverField = UploadField::create('DefaultAlbumCover');
$DefaultAlbumCoverField->folderName = "PhotoGallery";
$DefaultAlbumCoverField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
$fields = parent::getCMSFields();
$AlbumsGridField = new GridField("PhotoAlbums", "Album", $this->PhotoAlbums(), GridFieldConfig::create()->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldAddNewButton('toolbar-header-right'))->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldDataColumns())->addComponent(new GridFieldPaginator(50))->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldFilterHeader())->addComponent($sortable = new GridFieldSortableRows('SortID')));
if ($this->AlbumDefaultTop == true) {
$sortable->setAppendToTop(true);
}
$fields->addFieldToTab("Root.Albums", $AlbumsGridField);
$fields->addFieldToTab("Root.Config", HeaderField::create("Album Settings"));
$fields->addFieldToTab("Root.Config", $DefaultAlbumCoverField);
$fields->addFieldToTab("Root.Config", SliderField::create('AlbumsPerPage', 'Number of Albums Per Page', 1, 25));
$fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailWidth", "Album Cover Thumbnail Width", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailHeight", "Album Cover Thumbnail Height", 50, 400));
$fields->addFieldToTab("Root.Config", CheckboxField::create("ShowAllPhotoAlbums")->setTitle("Show photo album even if it's empty"));
$fields->addFieldToTab("Root.Config", CheckboxField::create("AlbumDefaultTop")->setTitle("Sort new albums to the top by default"));
$fields->addFieldToTab("Root.Config", HeaderField::create("Photo Settings"));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotosPerPage", "Number of Photos Per Page", 1, 50));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailWidth", "Photo Thumbnail Width", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailHeight", "Photo Thumbnail Height", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullWidth", "Photo Fullsize Width", 400, 1200));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullHeight", "Photo Fullsize Height", 400, 1200));
$fields->addFieldToTab("Root.Config", CheckboxField::create("PhotoDefaultTop")->setTitle("Sort new photos to the top by default"));
return $fields;
}
示例4: 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;
}
示例5: LinkForm
/**
* The LinkForm for the dialog window
*
* @return Form
**/
public function LinkForm()
{
$link = $this->getLinkObject();
$action = FormAction::create('doSaveLink', _t('Linkable.SAVE', 'Save'))->setUseButtonTag('true');
if (!$this->isFrontend) {
$action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept');
}
$link = null;
if ($linkID = (int) $this->request->getVar('LinkID')) {
$link = Link::get()->byID($linkID);
}
$link = $link ? $link : singleton('Link');
$link->setAllowedTypes($this->getAllowedTypes());
$fields = $link->getCMSFields();
$title = $link ? _t('Linkable.EDITLINK', 'Edit Link') : _t('Linkable.ADDLINK', 'Add Link');
$fields->insertBefore(HeaderField::create('LinkHeader', $title), _t('Linkable.TITLE', 'Title'));
$actions = FieldList::create($action);
$form = Form::create($this, 'LinkForm', $fields, $actions);
if ($link) {
$form->loadDataFrom($link);
$fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID));
}
$this->owner->extend('updateLinkForm', $form);
return $form;
}
示例6: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet("Root", new Tab("Main", TextField::create("Title", "Title"), GridField::create("Slides", "Nivo Slide", $this->Slides(), GridFieldConfig_RecordEditor::create())), new Tab("Advanced", DropdownField::create("Theme", "Theme", self::get_all_themes()), DropdownField::create("Effect", "Effect", $this->dbObject("Effect")->enumValues()), NumericField::create("AnimationSpeed", "Animation Speed")->setDescription("Animation speed in milliseconds."), NumericField::create("PauseTime", "Pause Time")->setDescription("Pause time on each frame in milliseconds."), TextField::create("PrevText", "Previous Text"), TextField::create("NextText", "Next Text"), NumericField::create("Slices", "Slices")->setDescription("Number of slices for slice animation effects."), NumericField::create("BoxCols", "Box Columns")->setDescription("Number of box columns for box animation effects."), NumericField::create("BoxRows", "Box Rows")->setDescription("Number of box rows for box animation effects."), NumericField::create("StartSlide", "Start Slide")->setDescription("Slide to start on (0 being the first)."), HeaderField::create("ControlHeading", "Control Options", 4), CompositeField::create(array(CheckboxField::create("DirectionNav", "Display Direction Navigation?"), CheckboxField::create("ControlNav", "Display Control Navigation?"), CheckboxField::create("ControlNavThumbs", "Use thumbnails for control nav?"), CheckboxField::create("PauseOnHover", "Stop the animation whilst hovering?"), CheckboxField::create("ManualAdvance", "Force manual transition?"), CheckboxField::create("RandomStart", "Random Start?"))))));
$fields->extend("updateCMSFields", $fields);
return $fields;
}
示例7: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
Requirements::add_i18n_javascript(ADVANCED_WORKFLOW_DIR . '/javascript/lang');
// Add timepicker functionality
// @see https://github.com/trentrichardson/jQuery-Timepicker-Addon
Requirements::css(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css');
Requirements::css(ADVANCED_WORKFLOW_DIR . '/css/WorkflowCMS.css');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/javascript/WorkflowField.js');
$this->setIsWorkflowInEffect();
$fields->findOrMakeTab('Root.PublishingSchedule', _t('WorkflowEmbargoExpiryExtension.TabTitle', 'Publishing Schedule'));
if ($this->getIsWorkflowInEffect()) {
$fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = Datetimefield::create('DesiredUnPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_UNPUBLISH_DATE', 'Requested un-publish date')), Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date'))->setDisabled(true), Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))->setDisabled(true)));
} else {
$fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))));
}
$dt->getDateField()->setConfig('showcalendar', true);
$ut->getDateField()->setConfig('showcalendar', true);
$dt->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
$ut->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
// Enable a jQuery-UI timepicker widget
if (self::$showTimePicker) {
$dt->getTimeField()->addExtraClass('hasTimePicker');
$ut->getTimeField()->addExtraClass('hasTimePicker');
}
}
示例8: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet("Root", new Tab("Main", HeaderField::create("Application Settings", 3), TextField::create("FacebookConsumerKey", "Consumer Key"), PasswordField::create("FacebookConsumerSecret", "Consumer Secret"), OptionsetField::create("EnableFacebookLogin", "Facebook Login", array(0 => "Disabled", 1 => "Enabled")), OptionsetField::create("EnableFacebookSignup", "Facebook Signup", array(0 => "Disabled", 1 => "Enabled")))));
$this->extend("updateCMSFields", $fields);
return $fields;
}
示例9: __construct
public function __construct($controller, $name, Order $order)
{
$this->order = $order;
$fields = FieldList::create(HiddenField::create('OrderID', '', $order->ID));
$actions = FieldList::create();
//payment
if (self::config()->allow_paying && $order->canPay()) {
$gateways = GatewayInfo::get_supported_gateways();
//remove manual gateways
foreach ($gateways as $gateway => $gatewayname) {
if (GatewayInfo::is_manual($gateway)) {
unset($gateways[$gateway]);
}
}
if (!empty($gateways)) {
$fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MAKEPAYMENT", "Make Payment")));
$outstandingfield = Currency::create();
$outstandingfield->setValue($order->TotalOutstanding());
$fields->push(LiteralField::create("Outstanding", sprintf(_t("OrderActionsForm.OUTSTANDING", "Outstanding: %s"), $outstandingfield->Nice())));
$fields->push(OptionsetField::create('PaymentMethod', _t("OrderActionsForm.PAYMENTMETHOD", "Payment Method"), $gateways, key($gateways)));
$actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PAYORDER', 'Pay outstanding balance')));
}
}
//cancelling
if (self::config()->allow_cancelling && $order->canCancel()) {
$actions->push(FormAction::create('docancel', _t('OrderActionsForm.CANCELORDER', 'Cancel this order')));
}
parent::__construct($controller, $name, $fields, $actions);
$this->extend("updateForm", $order);
}
示例10: getCMSFields
/**
* getCMSFields
* Construct the FieldList used in the CMS. To provide a
* smarter UI we don't use the scaffolding provided by
* parent::getCMSFields.
*
* @return FieldList
*/
public function getCMSFields()
{
Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
//Create the FieldList and push the Root TabSet on to it.
$fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Class"), CompositeField::create(TextField::create("Title", "Class Name")->setRightTitle("i.e. Zero Rate, Standard Rate.")))));
return $fields;
}
示例11: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// Use SortableUploadField instead of UploadField!
$imagesTab = $fields->findOrMakeTab('Root.Images');
$owner = $this->owner;
if ($owner::config()->allow_images) {
$limit = $owner::config()->images_count;
$uploadClass = class_exists("SortableUploadField") && $this->owner->Sorter == "SortOrder" ? "SortableUploadField" : "UploadField";
$imageField = $uploadClass::create('Images');
$imageField->setConfig('allowedMaxFileNumber', $limit);
$imageField->setFolderName('Uploads/' . $this->owner->ClassName . '/' . $this->owner->ID);
if ($limit == 1) {
$imagesTab->setTitle(_t("Object.IMAGETAB", "Images"));
$imageField->setTitle(_t("Object.IMAGEUPLOADLABEL", "Image"));
} else {
$imagesTab->setTitle(_t("Object.IMAGESTAB", "Images"));
$imageField->setTitle(_t("Object.IMAGESUPLOADLABEL", "Images"));
$imageField->setDescription(sprintf(_t("Object.IMAGESUPLOADLIMIT", "Images count limit: %s"), $limit));
if ($this->owner->Sorter == "SortOrder") {
$message = class_exists("SortableUploadField") ? _t("Object.IMAGESUPLOADHEADING", "<span style='color: green'>Sort images by draging thumbnail</span>") : _t("Object.IMAGESUPLOADHEADINGWRONG", "<span style='color: red'>Sorting images by draging thumbnails (SortOrder) not allowed. Missing module SortabeUploadField.</span>");
} else {
$message = _t("Object.IMAGESSORTERNOTICE", "Correct image sorting is visible on frontend only (if Sort by = Title, ID)");
}
$dropdownSorter = DropdownField::create('Sorter', _t("Object.IMAGESSORTER", "Sort images by: "))->setSource($this->owner->dbObject('Sorter')->enumValues());
$fields->addFieldToTab('Root.Images', $dropdownSorter);
$fields->addFieldToTab('Root.Images', HeaderField::create('ImagesNotice', $message)->setHeadingLevel(4));
}
$fields->addFieldToTab('Root.Images', $imageField);
} else {
$fields->removeByName($imagesTab->Name);
}
}
示例12: getCMSFields
/**
* getCMSFields
* Construct the FieldList used in the CMS. To provide a
* smarter UI we don't use the scaffolding provided by
* parent::getCMSFields.
*
* @return FieldList
*/
public function getCMSFields()
{
Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
//Create the FieldList and push the Root TabSet on to it.
$fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Zone"), CompositeField::create(DropdownField::create("Enabled", "Enable this zone?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not disable the default tax zone." : "If enabled your store will use the rates defined in this zone for customers in the selected country.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false), !$this->exists() ? CountryDropdownField::create("Title", "Country")->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not select a country as this zone applies to all countries." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false) : "", $this->exists() ? GridField::create("TaxZones_TaxRates", "Tax Rates within the '" . $this->Title . "' Tax Zone", $this->TaxRates(), GridFieldConfig_RecordEditor::create()) : ""))));
return $fields;
}
示例13: __construct
public function __construct($controller, $name = "PostagePaymentForm")
{
// Get delivery data and postage areas from session
$delivery_data = Session::get("Commerce.DeliveryDetailsForm.data");
$country = $delivery_data['DeliveryCountry'];
$postcode = $delivery_data['DeliveryPostCode'];
$postage_areas = $controller->getPostageAreas($country, $postcode);
// Loop through all postage areas and generate a new list
$postage_array = array();
foreach ($postage_areas as $area) {
$area_currency = new Currency("Cost");
$area_currency->setValue($area->Cost);
$postage_array[$area->ID] = $area->Title . " (" . $area_currency->Nice() . ")";
}
$postage_id = Session::get('Commerce.PostageID') ? Session::get('Commerce.PostageID') : 0;
// Setup postage fields
$postage_field = CompositeField::create(HeaderField::create("PostageHeader", _t('Commerce.Postage', "Postage")), OptionsetField::create("PostageID", _t('Commerce.PostageSelection', 'Please select your prefered postage'), $postage_array)->setValue($postage_id))->setName("PostageFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
// Get available payment methods and setup payment
$payment_methods = SiteConfig::current_site_config()->PaymentMethods();
// Deal with payment methods
if ($payment_methods->exists()) {
$payment_map = $payment_methods->map('ID', 'Label');
$payment_value = $payment_methods->filter('Default', 1)->first()->ID;
} else {
$payment_map = array();
$payment_value = 0;
}
$payment_field = CompositeField::create(HeaderField::create('PaymentHeading', _t('Commerce.Payment', 'Payment'), 2), OptionsetField::create('PaymentMethodID', _t('Commerce.PaymentSelection', 'Please choose how you would like to pay'), $payment_map, $payment_value))->setName("PaymentFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
$fields = FieldList::create(CompositeField::create($postage_field, $payment_field)->setName("PostagePaymentFields")->addExtraClass("units-row")->addExtraClass("line"));
$back_url = $controller->Link("billing");
$actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('doContinue', _t('Commerce.PaymentDetails', 'Enter Payment Details'))->addExtraClass('btn')->addExtraClass('commerce-action-next')->addExtraClass('btn-green'));
$validator = RequiredFields::create(array("PostageID", "PaymentMethod"));
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例14: getCMSFields
public function getCMSFields()
{
Requirements::css('widgetify/css/widgetify_cms.css');
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
Requirements::javascript('widgetify/scripts/widgetify_page.js');
$fields = parent::getCMSFields();
$fields->push(HiddenField::create('WidgetifyContent', 'WidgetifyContent'));
$fields->push(HiddenField::create('ThisID', 'ThisID', $this->ID));
$tab = $fields->findOrMakeTab('Root.Main');
$tab->insertAfter(HeaderField::create('WidgetifyTitle', 'Widgetify Template', 3), 'Metadata');
if (!$this->WidgetifyTemplateID) {
$this->WidgetifyTemplateID = 0;
}
$templatesMap = DataList::create('WidgetifyTemplate')->map();
$tab->insertAfter(DropdownField::create('WidgetifyTemplateID', 'Select Template', $templatesMap)->setEmptyString('- Select -'), 'WidgetifyTitle');
$tab->insertAfter(CheckboxField::create('CSSFrontend', 'Apply template Stylesheet to front-end page'), 'WidgetifyTemplateID');
$tab->insertAfter(CheckboxField::create('JSFrontend', 'Apply template Javascript to front-end page'), 'CSSFrontend');
$tab->insertAfter(HeaderField::create('WidgetifyPreviewTitle', 'Widgetify Content', 3), 'JSFrontend');
$tab->insertAfter(LiteralField::create('WidgetifyPreview', '<div id="widgetifyPreview" class="widgetifyTemplate"></div>'), 'WidgetifyPreviewTitle');
$htmlField = HtmlEditorField::create('WidgetDynamicContent', false);
$editorFieldContents = '
<div id="WidgetDynamicContentHolder" class="WidgetDynamicContentHolder">
<p id="edit-widget-title">Edit content</p>' . $htmlField->forTemplate() . '
<p class="widget-edit-actions">
<a href="javascript:;" id="save-widget-content" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary">Update</a>
<a href="javascript:;" id="cancel-widget-content" class="ss-ui-action-destructive ui-button ui-widget ui-state-default ui-button-text-icon-primary ui-corner-left ss-ui-button">Cancel</a>
</p>
</div>';
$tab->insertAfter(LiteralField::create('WidgetDynamicContentPlaceHolder', $editorFieldContents), 'WidgetifyPreview');
$fields->removeFieldFromTab('Root.Main', 'Content');
return $fields;
}
示例15: getModularCMSFields
function getModularCMSFields($relationName = 'Modules', $title = 'Content Modules')
{
$fields = array();
$GLOBALS['_CONTENT_MODULE_PARENT_PAGEID'] = $this->owner->ID;
$area = $this->owner->obj($relationName);
if ($area && $area->exists()) {
$fields[] = HeaderField::create($relationName . 'Header', $title, 2);
$fields[] = GridField::create($relationName, $title, $area->Modules(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldOrderableRows('SortOrder'))->removeComponentsByType('GridFieldAddNewButton')->addComponent($add = new GridFieldAddNewMultiClass()));
if (($allowed_modules = $this->owner->Config()->get('allowed_modules')) && is_array($allowed_modules) && count($allowed_modules)) {
if (isset($allowed_modules[$relationName])) {
$add->setClasses($allowed_modules[$relationName]);
} else {
$add->setClasses($allowed_modules);
}
} else {
// Remove the base "ContentModule" from allowed modules.
$classes = array_values(ClassInfo::subclassesFor('ContentModule'));
sort($classes);
if (($key = array_search('ContentModule', $classes)) !== false) {
unset($classes[$key]);
}
$add->setClasses($classes);
}
} else {
$fields[] = LiteralField::create('SaveFirstToAddModules', '<div class="message">You must save first before you can add modules.</div>');
}
return $fields;
}