• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP LiteralField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中LiteralField的典型用法代码示例。如果您正苦于以下问题:PHP LiteralField类的具体用法?PHP LiteralField怎么用?PHP LiteralField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了LiteralField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: ItemEditForm

 /**
  * Additional magic happens here. Trick LeftAndMain into thinking we're a previewable SiteTree object.
  * 
  * @return Form
  */
 public function ItemEditForm()
 {
     Requirements::javascript(MODULATOR_PATH . '/javascript/LeftAndMain.Preview.js');
     $form = parent::ItemEditForm();
     $record = $this->getRecord();
     // Hide the 'Save & publish' button if we're on a brand new module.
     if ($record && $record->ID == 0) {
         $actions = $form->Actions();
         // Remove the publish button on the pre-module state
         $actions->removeByName('action_publish');
         // Remove the save action if there are no sub-classes to instantiate
         $classes = ClassInfo::subclassesFor('PageModule');
         unset($classes['PageModule']);
         if (!count($classes)) {
             $actions->removeByName('action_save');
         }
     }
     // Enable CMS preview
     // .cms-previewable enables the preview panel in the front-end
     // .cms-pagemodule CSS class is used by our javascript to handle previews
     if ($form && is_object($form)) {
         $form->addExtraClass('cms-previewable cms-pagemodule');
     }
     // Creat a navigaor and point it at the parent page
     $navigator = new SilverStripeNavigator($this->record->Page());
     $navField = new LiteralField('SilverStripeNavigator', $navigator->renderWith('LeftAndMain_SilverStripeNavigator'));
     $navField->setAllowHTML(true);
     $fields = $form->Fields();
     $fields->push($navField);
     return $form;
 }
开发者ID:touchcast,项目名称:modulator,代码行数:36,代码来源:PageModuleVersionedDataObjectDetailsForm.php


示例2: getEditForm

 /**
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     $siteConfig = SiteConfig::current_site_config();
     $fields = $siteConfig->getCMSFields();
     // Tell the CMS what URL the preview should show
     $fields->push(new HiddenField('PreviewURL', 'Preview URL', RootURLController::get_homepage_link()));
     // Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
     $fields->push($navField = new LiteralField('SilverStripeNavigator', $this->getSilverStripeNavigator()));
     $navField->setAllowHTML(true);
     $actions = $siteConfig->getCMSActions();
     $form = CMSForm::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
     $form->setResponseNegotiator($this->getResponseNegotiator());
     $form->addExtraClass('cms-content center cms-edit-form');
     // don't add data-pjax-fragment=CurrentForm, its added in the content template instead
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     $form->setHTMLID('Form_EditForm');
     $form->loadDataFrom($siteConfig);
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     // Use <button> to allow full jQuery UI styling
     $actions = $actions->dataFields();
     if ($actions) {
         foreach ($actions as $action) {
             $action->setUseButtonTag(true);
         }
     }
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:prostart,项目名称:erics-homes,代码行数:33,代码来源:CMSSettingsController.php


示例3: getCompositeField

 /**
  * @return Comosite FieldSet with Categorys and Items
  */
 function getCompositeField()
 {
     //create new composite field group for each category
     $oCatFieldSet = new CompositeField();
     // Set the field group ID
     $oCatFieldSet->setID('Cat' . $this->ID);
     $oCatFieldSet->addExtraClass('category');
     //create new composite field group for each category
     $oCatField = new TextField($this->ID . '_' . $this->FieldName, $this->Title, null, null);
     $oCatField->addExtraClass('category-field');
     //Add Category Percentage Field to the Form
     $oCatFieldSet->push($oCatField);
     if ($this->Description) {
         $oCatDescField = new LiteralField($this->ID . '_Description', '<p class="category-field-desc">' . $this->Description . '</p>');
         $oCatDescField->addExtraClass('category-field');
         $oCatFieldSet->push($oCatDescField);
     }
     //Add item Composite Field to this Composite Field
     //now get all of the items matched with this category
     $oFormCategoryItems = self::FormCategoryItems();
     foreach ($oFormCategoryItems as $item) {
         $oCatFieldSet->push($item->getFormField());
     }
     return $oCatFieldSet;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:28,代码来源:FormCategory.php


示例4: injectNavigatorAndPreview

 private function injectNavigatorAndPreview(&$form, &$fields)
 {
     $editForm = $fields->fieldByName('EditForm');
     //TODO: Do we need to verify we are in the right controller?
     $template = Controller::curr()->getTemplatesWithSuffix('_SilverStripeNavigator');
     $navigator = new SilverStripeNavigator($this->owner->record);
     $field = new LiteralField('SilverStripeNavigator', $navigator->renderWith($template));
     $field->setAllowHTML(true);
     $fields->push($field);
     $form->addExtraClass('cms-previewable');
     $form->addExtraClass(' cms-previewabledataobject');
     $form->removeExtraClass('cms-panel-padded center');
 }
开发者ID:helpfulrobot,项目名称:jotham-silverstripe-dataobject-preview,代码行数:13,代码来源:PreviewableDataObjectExt.php


示例5: ItemEditForm

 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     // Do these action update only when the current record is_a newsletter
     if ($this->record && $this->record instanceof Newsletter) {
         $form->setActions($this->updateCMSActions($form->Actions()));
         $form->Fields()->push(new HiddenField("PreviewURL", "PreviewURL", $this->LinkPreview()));
         // Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
         $navField = new LiteralField('SilverStripeNavigator', $this->getSilverStripeNavigator());
         $navField->setAllowHTML(true);
         $form->Fields()->push($navField);
     }
     return $form;
 }
开发者ID:alexandruz,项目名称:silverstripe-newsletter,代码行数:14,代码来源:NewsletterGridFieldDetailForm.php


示例6: index

 public function index()
 {
     $site = SiteConfig::current_site_config();
     $order = $this->order;
     // Setup the paypal gateway URL
     if (Director::isDev()) {
         $gateway_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     } else {
         $gateway_url = "https://www.paypal.com/cgi-bin/webscr";
     }
     $callback_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, "callback", $this->payment_gateway->ID);
     $success_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, 'complete');
     $error_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, 'complete', 'error');
     $back_url = Controller::join_links(Director::absoluteBaseURL(), Checkout_Controller::config()->url_segment, "finish");
     $fields = new FieldList(HiddenField::create('business', null, $this->payment_gateway->BusinessID), HiddenField::create('item_name', null, $site->Title), HiddenField::create('cmd', null, "_cart"), HiddenField::create('paymentaction', null, "sale"), HiddenField::create('invoice', null, $order->OrderNumber), HiddenField::create('custom', null, $order->OrderNumber), HiddenField::create('upload', null, 1), HiddenField::create('discount_amount_cart', null, $order->DiscountAmount), HiddenField::create('amount', null, $order->Total), HiddenField::create('currency_code', null, $site->Currency()->GatewayCode), HiddenField::create('first_name', null, $order->FirstName), HiddenField::create('last_name', null, $order->Surname), HiddenField::create('address1', null, $order->Address1), HiddenField::create('address2', null, $order->Address2), HiddenField::create('city', null, $order->City), HiddenField::create('zip', null, $order->PostCode), HiddenField::create('country', null, $order->Country), HiddenField::create('email', null, $order->Email), HiddenField::create('return', null, $success_url), HiddenField::create('notify_url', null, $callback_url), HiddenField::create('cancel_return', null, $error_url));
     $i = 1;
     foreach ($order->Items() as $item) {
         $fields->add(HiddenField::create('item_name_' . $i, null, $item->Title));
         $fields->add(HiddenField::create('amount_' . $i, null, number_format($item->Price + $item->Tax, 2)));
         $fields->add(HiddenField::create('quantity_' . $i, null, $item->Quantity));
         $i++;
     }
     // Add shipping as an extra product
     $fields->add(HiddenField::create('item_name_' . $i, null, _t("Commerce.Postage", "Postage")));
     $fields->add(HiddenField::create('amount_' . $i, null, number_format($order->PostageCost + $order->PostageTax, 2)));
     $fields->add(HiddenField::create('quantity_' . $i, null, "1"));
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('Submit', _t('Commerce.ConfirmPay', 'Confirm and Pay'))->addExtraClass('btn')->addExtraClass('btn-green'));
     $form = Form::create($this, 'Form', $fields, $actions)->addExtraClass('forms')->setFormMethod('POST')->setFormAction($gateway_url);
     $this->extend('updateForm', $form);
     return array("Title" => _t('Commerce.CheckoutSummary', "Summary"), "MetaTitle" => _t('Commerce.CheckoutSummary', "Summary"), "Form" => $form);
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:31,代码来源:PayPalHandler.php


示例7: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('Features');
     $fields->removeByName('ExtraContent');
     $regContent = $fields->dataFieldByName('RegistrationContent');
     $afterContent = $fields->dataFieldByName('AfterRegistrationContent');
     $profileContent = $fields->dataFieldByName('ProfileContent');
     $regContent->addExtraClass('no-pagebreak');
     $afterContent->addExtraClass('no-pagebreak');
     $profileContent->addExtraClass('no-pagebreak');
     $fields->insertAfter(TextareaField::create('ApprovalEmailTemplate', 'Approval Email Template'), 'EmailTemplate');
     $fields->insertAfter(TextField::create('ApprovalEmailSubject', 'Approval Email Subject'), 'EmailTemplate');
     $fields->insertAfter(TextareaField::create('ExpiryReminderEmailTemplate', 'Expiry Reminder Email Template'), 'ApprovalEmailTemplate');
     $fields->insertAfter(TextField::create('ExpiryReminderEmailSubject', 'Expiry Reminder Email Subject'), 'ApprovalEmailTemplate');
     $fields->insertAfter(TextareaField::create('ExpiryEmailTemplate', 'Expiry Email Template'), 'ExpiryReminderEmailTemplate');
     $fields->insertAfter(TextField::create('ExpiryEmailSubject', 'Expiry Email Subject'), 'ExpiryReminderEmailTemplate');
     $fields->addFieldToTab('Root.Members', LiteralField::create('MembersNote', '<p class="message"><strong>Note:</strong> This list has been filtered to include current and pending members only. Use the Members admin area for handling expired memberships and non-member website users.</p>'));
     $members = Member::get()->exclude(array('MembershipStatus' => 'Not applied'))->exclude(array('MembershipStatus' => 'Expired'))->sort(array('ExpiryDate' => 'ASC'));
     $gridField = new GridField('Members', 'NZLARP Members', $members, $config = GridFieldConfig_RecordEditor::create());
     $gridField->setModelClass('Member');
     $columns = $config->getComponentByType('GridFieldDataColumns');
     $columns->setFieldFormatting(array('LastEdited' => function ($value, $item) {
         return $item->LastEditedNice();
     }));
     $columns->setDisplayFields(array('getName' => 'Name', 'Region.Title' => 'Region', 'MembershipStatus' => 'Status', 'ExpiryDate' => 'Expires', 'LastEdited' => 'Last Activity'));
     $fields->addFieldToTab('Root.Members', $gridField);
     $config->getComponentByType('GridFieldPaginator')->setItemsPerPage(200);
     return $fields;
 }
开发者ID:adrexia,项目名称:nzlarps,代码行数:30,代码来源:RegistrationPage.php


示例8: 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


示例9: updateDynamicListCMSFields

 public function updateDynamicListCMSFields($fields)
 {
     // Make sure the draft records are being looked at.
     $stage = Versioned::current_stage();
     Versioned::reading_stage('Stage');
     $used = EditableFormField::get()->filter(array('ClassName:PartialMatch' => 'DynamicList'));
     // Determine whether this dynamic list is being used anywhere.
     $found = array();
     foreach ($used as $field) {
         // This information is stored using a serialised list, therefore we need to iterate through.
         if ($field->getSetting('ListTitle') === $this->owner->Title) {
             // Make sure there are no duplicates recorded.
             if (!isset($found[$field->ParentID]) && ($form = UserDefinedForm::get()->byID($field->ParentID))) {
                 $found[$field->ParentID] = "<a href='{$form->CMSEditLink()}'>{$form->Title}</a>";
             }
         }
     }
     // Display whether there were any dynamic lists found on user defined forms.
     if (count($found)) {
         $fields->removeByName('UsedOnHeader');
         $fields->addFieldToTab('Root.Main', HeaderField::create('UsedOnHeader', 'Used On', 5));
     }
     $display = count($found) ? implode('<br>', $found) : 'This dynamic list is <strong>not</strong> used.';
     $fields->removeByName('UsedOn');
     $fields->addFieldToTab('Root.Main', LiteralField::create('UsedOn', '<div>' . $display . '</div>'));
     Versioned::reading_stage($stage);
 }
开发者ID:sheadawson,项目名称:silverstripe-dynamiclists,代码行数:27,代码来源:DynamicListUDFExtension.php


示例10: getCMSFields

 public function getCMSFields($params = null)
 {
     //fields that shouldn't be changed once coupon is used
     $fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
     if (!$this->isInDB()) {
         $fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
     }
     $this->extend("updateCMSFields", $fields, $params);
     if ($count = $this->getUseCount()) {
         $fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
     }
     if ($params && isset($params['forcetype'])) {
         $valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
         $fields->insertAfter($valuefield, "Type");
         $fields->removeByName("Type");
     } elseif ($this->Type && (double) $this->{$this->Type}) {
         $valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
         $fields->removeByName("Type");
         $fields->insertAfter($valuefield, "ActionTitle");
         $fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
         if ($this->Type == "Percent") {
             $fields->insertAfter($maxamountfield, "Percent");
         }
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:26,代码来源:Discount.php


示例11: getCMSFields

 public function getCMSFields()
 {
     Requirements::css('widgetify/thirdparty/codemirror-3.18/lib/codemirror.css');
     Requirements::css('widgetify/css/widgetify_cms.css');
     Requirements::javascript('framework/thirdparty/jquery/jquery.js');
     Requirements::javascript('widgetify/thirdparty/codemirror-3.18/lib/codemirror.js');
     Requirements::javascript('widgetify/thirdparty/codemirror-3.18/mode/xml/xml.js');
     Requirements::javascript('widgetify/thirdparty/codemirror-3.18/mode/javascript/javascript.js');
     Requirements::javascript('widgetify/thirdparty/codemirror-3.18/mode/css/css.js');
     Requirements::javascript('widgetify/scripts/template_editor.js');
     $fields = FieldList::create();
     $fields->push(TextField::create('Title', 'Template Title', false, 100));
     $fields->push(HeaderField::create('WidgetifyPreviewTitle', 'Preview', 4));
     $fields->push(LiteralField::create('WidgetifyPreview', '<div id="widgetifyPreview" class="widgetifyTemplate"><p><strong>Click "Refresh &amp; validate" to load preview</strong></p></div><p><a href="javascript:;" id="refreshAndValidate" class="ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary">Refresh &amp; validate</a></p>'));
     $fields->push(LiteralField::create('WidgetifyLog', '<p><strong>Validation log:</strong></p><div id="widgetifyLog"></div>'));
     $fields->push(HeaderField::create('WidgetifyEditorTitle', 'Template editor', 4));
     $fields->push(LiteralField::create('WidgetifyEditorHelp', '<p><strong>Note:</strong> in the HTML tab, insert the tag <strong>{widget-UniqueIdentifier}</strong> where widgets should be placed. <em>Example: {widget-1} {widget-2} ...</em></p>'));
     $fields->push(LiteralField::create('Tabs', '<p class="tabs"><a href="javascript:;" id="tabTemplate" class="selected tabChange">HTML</a><a href="javascript:;" id="tabCSS" class="tabChange">Stylesheet</a><a href="javascript:;" id="tabJS" class="tabChange">Javascript</a></p>'));
     $fields->push(TextareaField::create('TemplateContent', false));
     $fields->push(TextareaField::create('CSSContent', false));
     $fields->push(TextareaField::create('JSContent', false));
     if ($this->ID) {
         $fields->push(HeaderField::create('WidgetifyRelatedTitle', 'Pages using this template', 4));
         $fields->push(LiteralField::create('AppliedTo', $this->_getTablePages()));
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:nzaa-widgetify,代码行数:27,代码来源:WidgetifyTemplate.php


示例12: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList([TextField::create('Title')]);
     if ($this->exists()) {
         $folderName = 'Documents';
         $config = $this->Page()->exists() ? $this->Page()->config()->get('page_documents') : null;
         if (is_array($config)) {
             if (isset($config['folder'])) {
                 $folderName = $config['folder'];
             }
             if (isset($config['section']) && $config['section']) {
                 $filter = new URLSegmentFilter();
                 $section = implode('-', array_map(function ($string) {
                     return ucfirst($string);
                 }, explode('-', $filter->filter($this->Title))));
                 $folderName .= '/' . $section;
             }
         }
         $fields->push(SortableUploadField::create('Documents', 'Documents')->setDescription('Drag documents by thumbnail to sort')->setFolderName($folderName));
     } else {
         $fields->push(LiteralField::create('DocumentsNotSaved', '<p>Save category to add documents</p>'));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:webfox,项目名称:silverstripe-page-documents,代码行数:25,代码来源:PageDocumentCategory.php


示例13: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldFromTab('Root', 'Pages');
     $fields->removeFieldsFromTab('Root.Main', array('SortOrder', 'showBlockbyClass', 'shownInClass', 'MemberVisibility'));
     $fields->addFieldToTab('Root.Main', LiteralField::create('Status', 'Published: ' . $this->Published()), 'Title');
     $memberGroups = Group::get();
     $sourcemap = $memberGroups->map('Code', 'Title');
     $source = array('anonymous' => 'Anonymous visitors');
     foreach ($sourcemap as $mapping => $key) {
         $source[$mapping] = $key;
     }
     $memberVisibility = new CheckboxSetField($name = "MemberVisibility", $title = "Show block for specific groups", $source);
     $memberVisibility->setDescription('Show this block only for the selected group(s). If you select no groups, the block will be visible to all members.');
     $availabelClasses = $this->availableClasses();
     $inClass = new CheckboxSetField($name = "shownInClass", $title = "Show block for specific content types", $availabelClasses);
     $filterSelector = OptionsetField::create('showBlockbyClass', 'Choose filter set', array('0' => 'by page', '1' => 'by page/data type'))->setDescription('<p><br /><strong>by page</strong>: block will be displayed in the selected page(s)<br /><strong>by page/data type</strong>: block will be displayed on the pages created with the particular page/data type. e.g. is <strong>"InternalPage"</strong> is picked, the block will be displayed, and will ONLY be displayed on all <strong>Internal Pages</strong></p>');
     $availablePages = Page::get()->exclude('ClassName', array('ErrorPage', 'RedirectorPage', 'VirtualPage'));
     $pageSelector = new CheckboxSetField($name = "Pages", $title = "Show on Page(s)", $availablePages->map('ID', 'Title'));
     if ($this->canConfigPageAndType(Member::currentUser())) {
         $fields->addFieldsToTab('Root.VisibilitySettings', array($filterSelector, $pageSelector, $inClass));
     }
     if ($this->canConfigMemberVisibility(Member::currentUser())) {
         $fields->addFieldToTab('Root.VisibilitySettings', $memberVisibility);
     }
     if (!$fields->fieldByName('Options')) {
         $fields->insertBefore($right = RightSidebar::create('Options'), 'Root');
     }
     $fields->addFieldsToTab('Options', array(CheckboxField::create('addMarginTop', 'add "margin-top" class to block wrapper'), CheckboxField::create('addMarginBottom', 'add "margin-bottom" class to block wrapper')));
     return $fields;
 }
开发者ID:salted-herring,项目名称:silverstripe-block,代码行数:31,代码来源:Block.php


示例14: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     //adding upload field - if item has already been saved
     if ($this->ID && $this->AssetsFolderID != 0) {
         //this is the default, for non multi-language sites
         if (!class_exists('Translatable') || $this->Locale == Translatable::default_locale()) {
             //Use SortableUploadField instead of UploadField!
             //The upload directory is expected to have been set in {@see UploadDirRules},
             //and should be something like: "assets/ID-Pagename"
             //TODO: This could easily be configurable through yml files (to e.g. "assets/galleries/ID"),
             //so this module could do without the upload dir rules
             //
             //read more about adding additinoal metadata to images here:
             //http://doc.silverstripe.org/framework/en/reference/uploadfield
             $imageField = new SortableUploadField('Images', '');
             $fields->addFieldToTab('Root.Images', $imageField);
         } else {
             $orig = $this->getTranslation(Translatable::default_locale());
             $html = sprintf('<a href="%s">%s</a>', Controller::join_links($orig->CMSEditLink(), '?locale=' . $orig->Locale), 'Images are administered through ' . i18n::get_locale_name($orig->Locale));
             $fields->addFieldToTab('Root.Images', LiteralField::create('ImagesDesc', $html));
         }
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:titledk-silverstripe-gallery,代码行数:25,代码来源:GalleryPage.php


示例15: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $createdDate = new Date();
     $createdDate->setValue($this->Created);
     $reviewer = $this->Member()->Name;
     $email = $this->Member()->Email;
     $star = "&#9733;";
     $emptyStar = "&#9734;";
     $fields->insertBefore(LiteralField::create('reviewer', '<p>Written by <strong>' . $this->getMemberDetails() . '</strong><br />' . $createdDate->Format('l F jS Y h:i:s A') . '</p>'), 'Title');
     $fields->insertBefore(CheckboxField::create('Approved'), 'Title');
     $starRatings = $this->StarRatings();
     foreach ($starRatings as $starRating) {
         $cat = $starRating->StarRatingCategory;
         $stars = str_repeat($star, $starRating->Rating);
         $ratingStars = $stars;
         $maxRating = $starRating->MaxRating - $starRating->Rating;
         $emptyStarRepeat = str_repeat($emptyStar, $maxRating);
         $emptyStars = $emptyStarRepeat;
         /* 4/5 Stars */
         $ratingInfo = $ratingStars . $emptyStars . ' (' . $starRating->Rating . ' of ' . $starRating->MaxRating . ' Stars)';
         $fields->insertBefore(ReadonlyField::create('rating_' . $cat, $cat, html_entity_decode($ratingInfo, ENT_COMPAT, 'UTF-8')), 'Title');
     }
     $fields->removeByName('StarRatings');
     $fields->removeByName('MemberID');
     $fields->removeByName('ProductID');
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:clintlandrum-silverstripe-productreviews,代码行数:28,代码来源:ProductReview.php


示例16: __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);
 }
开发者ID:NobrainerWeb,项目名称:silverstripe-shop,代码行数:30,代码来源:OrderActionsForm.php


示例17: getCMSFields

 /**
  * Gets a list of form fields for editing the record.
  * These records should never be edited, so a readonly list of fields
  * is forced.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     preg_match("/<body[^>]*>(.*?)<\\/body>/is", $this->Body, $matches);
     $contents = $matches ? $matches[1] : "";
     $f = FieldList::create(ReadonlyField::create('To'), ReadonlyField::create('Subject'), ReadonlyField::create('BCC'), ReadonlyField::create('CC'), HeaderField::create('Email contents', 5), LiteralField::create('BodyContents', "<div class='field'>{$contents}</div>"));
     return $f;
 }
开发者ID:unclecheese,项目名称:silverstripe-permamail,代码行数:14,代码来源:SentEmail.php


示例18: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName(array('Lat', 'Lng'));
     // Adds Lat/Lng fields for viewing in the CMS
     $compositeField = CompositeField::create();
     $compositeField->push($overrideField = CheckboxField::create('LatLngOverride', 'Override Latitude and Longitude?'));
     $overrideField->setDescription('Check this box and save to be able to edit the latitude and longitude manually.');
     if ($this->owner->Lng && $this->owner->Lat) {
         $googleMapURL = 'http://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng;
         $googleMapDiv = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="' . $googleMapURL . '" target="_blank">' . $googleMapURL . '</a></div></div>';
         $compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv));
     }
     if ($this->owner->LatLngOverride) {
         $compositeField->push(TextField::create('Lat', 'Lat'));
         $compositeField->push(TextField::create('Lng', 'Lng'));
     } else {
         $compositeField->push(ReadonlyField::create('Lat_Readonly', 'Lat', $this->owner->Lat));
         $compositeField->push(ReadonlyField::create('Lng_Readonly', 'Lng', $this->owner->Lng));
     }
     if ($this->owner->hasExtension('Addressable')) {
         // If using addressable, put the fields with it
         $fields->addFieldToTab('Root.Address', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
     } else {
         if ($this->owner instanceof SiteTree) {
             // If SIteTree but not using Addressable, put after 'Metadata' toggle composite field
             $fields->insertAfter($compositeField, 'ExtraMeta');
         } else {
             $fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
         }
     }
 }
开发者ID:ajshort,项目名称:silverstripe-addressable,代码行数:31,代码来源:Geocodable.php


示例19: getCMSFields

 public function getCMSFields()
 {
     $datetimeField = DatetimeField::create("Date")->setTitle($this->fieldLabel("Date"));
     $datetimeField->getDateField()->setConfig("dmyfields", true);
     // Check if NewsImage should be saved in a seperate folder
     if (self::config()->save_image_in_seperate_folder == false) {
         $UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news");
     } else {
         if ($this->ID == "0") {
             $UploadField = FieldGroup::create(LiteralField::create("Save", $this->fieldLabel("SaveHelp")))->setTitle($this->fieldLabel("NewsImage"));
         } else {
             $UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news/" . $this->URLSegment);
         }
     }
     // Create direct link to NewsArticle
     if ($this->ID == "0") {
         // Little hack to hide $urlsegment when article isn't saved yet.
         $urlsegment = LiteralField::create("NoURLSegmentYet", "");
     } else {
         if ($NewsHolder = $this->NewsHolder()) {
             $baseLink = Controller::join_links(Director::absoluteBaseURL(), $NewsHolder->Link(), $this->URLSegment);
         }
         $urlsegment = Fieldgroup::create(LiteralField::create("URLSegment", "URLSegment")->setContent('<a href="' . $baseLink . '" target="_blank">' . $baseLink . '</a>'))->setTitle("URLSegment");
     }
     $fields = FieldList::create(new TabSet("Root", new Tab("Main", $urlsegment, TextField::create("Title")->setTitle($this->fieldLabel("Title")), $datetimeField, HTMLEditorField::create("Content")->setTitle($this->fieldLabel("Content")), $UploadField)));
     $this->extend("updateCMSFields", $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:arnhoe-silverstripe-simplenews,代码行数:28,代码来源:NewsArticle.php


示例20: updateCMSFields

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP LiveUser类代码示例发布时间:2022-05-23
下一篇:
PHP Listing类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap