public function updateCMSFields(FieldList $fields) { // Payment Methods $payment_table = GridField::create('PaymentMethods', _t("CheckoutAdmin.PaymentMethods", "Payment Methods"), $this->owner->PaymentMethods(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm())); // setup compressed payment options $payment_fields = ToggleCompositeField::create('PaymentSettings', _t("CheckoutAdmin.Payments", "Payment Settings"), array(TextField::create('PaymentNumberPrefix', _t("CheckoutAdmin.OrderPrefix", "Add prefix to order numbers"), null, 9)->setAttribute("placeholder", _t("CheckoutAdmin.OrderPrefixPlaceholder", "EG 'abc'")), TextAreaField::create('PaymentSuccessContent', _t("CheckoutAdmin.PaymentSuccessContent", "Payment successfull content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), TextAreaField::create('PaymentFailerContent', _t("CheckoutAdmin.PaymentFailerContent", "Payment failer content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), $payment_table)); // Add html description of how to edit contries $country_html = "<div class=\"field\">"; $country_html .= "<p>First select valid countries using the 2 character "; $country_html .= "shortcode (see http://fasteri.com/list/2/short-names-of-countries-and-iso-3166-codes).</p>"; $country_html .= "<p>You can add multiple countries seperating them with"; $country_html .= "a comma or use a '*' for all countries.</p>"; $country_html .= "</div>"; $country_html_field = LiteralField::create("CountryDescription", $country_html); // Deal with product features $postage_field = new GridField('PostageAreas', '', $this->owner->PostageAreas(), GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddNewInlineButton('toolbar-header-left'))); // Add country dropdown to inline editing $postage_field->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'TextField'), 'Country' => array('title' => 'ISO 3166 codes', 'field' => 'TextField'), 'ZipCode' => array('title' => 'Zip/Post Codes', 'field' => 'TextField'), 'Calculation' => array('title' => 'Base unit', 'callback' => function ($record, $column, $grid) { return DropdownField::create($column, "Based on", singleton('PostageArea')->dbObject('Calculation')->enumValues())->setValue("Weight"); }), 'Unit' => array('title' => 'Unit (equals or above)', 'field' => 'NumericField'), 'Cost' => array('title' => 'Cost', 'field' => 'NumericField'), 'Tax' => array('title' => 'Tax (percentage)', 'field' => 'NumericField'))); // Setup compressed postage options $postage_fields = ToggleCompositeField::create('PostageFields', 'Postage Options', array($country_html_field, $postage_field)); // Setup compressed postage options $discount_fields = ToggleCompositeField::create('DiscountFields', 'Discounts', array(GridField::create('Discounts', '', $this->owner->Discounts(), GridFieldConfig_RecordEditor::create()))); // Add config sets $fields->addFieldToTab('Root.Checkout', $payment_fields); $fields->addFieldToTab('Root.Checkout', $postage_fields); $fields->addFieldToTab('Root.Checkout', $discount_fields); }
public function getCMSFields() { $fields = FieldList::create(TextField::create('Title'), TextField::create('Teaser'), TextAreaField::create('Description'), $uploader = UploadField::create('Icon')); $uploader->setFolderName('feature-icons'); $uploader->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg', 'svg')); return $fields; }
public function getCMSFields() { $fields = FieldList::create(TextField::create('Name'), TextField::create('Job'), TextAreaField::create('Description'), $uploader = UploadField::create('Photo')); $uploader->setFolderName('profile-pictures'); $uploader->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg')); return $fields; }
public function FieldHolder($properties = array()) { Requirements::css(LINKABLE_PATH . '/css/embeddedobjectfield.css'); Requirements::javascript(LINKABLE_PATH . '/javascript/embeddedobjectfield.js'); if ($this->object && $this->object->ID) { $properties['SourceURL'] = TextField::create($this->getName() . '[sourceurl]', '')->setAttribute('placeholder', _t('Linkable.SOURCEURL', 'Source URL')); if (strlen($this->object->SourceURL)) { $properties['ObjectTitle'] = TextField::create($this->getName() . '[title]', _t('Linkable.TITLE', 'Title')); $properties['Width'] = TextField::create($this->getName() . '[width]', _t('Linkable.WIDTH', 'Width')); $properties['Height'] = TextField::create($this->getName() . '[height]', _t('Linkable.HEIGHT', 'Height')); $properties['ThumbURL'] = HiddenField::create($this->getName() . '[thumburl]', ''); $properties['Type'] = HiddenField::create($this->getName() . '[type]', ''); $properties['EmbedHTML'] = HiddenField::create($this->getName() . '[embedhtml]', ''); $properties['ObjectDescription'] = TextAreaField::create($this->getName() . '[description]', _t('Linkable.DESCRIPTION', 'Description')); $properties['ExtraClass'] = TextField::create($this->getName() . '[extraclass]', _t('Linkable.CSSCLASS', 'CSS class')); foreach ($properties as $key => $field) { if ($key == 'ObjectTitle') { $key = 'Title'; } elseif ($key == 'ObjectDescription') { $key = 'Description'; } $field->setValue($this->object->{$key}); } if ($this->object->ThumbURL) { $properties['ThumbImage'] = LiteralField::create($this->getName(), '<img src="' . $this->object->ThumbURL . '" />'); } } } else { $properties['SourceURL'] = TextField::create($this->getName() . '[sourceurl]', '')->setAttribute('placeholder', _t('Linkable.SOURCEURL', 'Source URL')); } $field = parent::FieldHolder($properties); return $field; }
/** * Add and re-arrange CMS fields for streamlined summary editing */ public function updateCMSFields(FieldList $fields) { // Remove all Meta fields $fields->removeByName('Metadata'); // Add summary fields $fields->addFieldToTab("Root.Main", TextAreaField::create("MetaDescription", "Content summary")->setDescription("Summarise the content of this page. This will be used for search engine results and social media so make it enticing.")->setAttribute('placeholder', $this->owner->getDefaultOGDescription())->setRows(2), "Content"); $fields->addFieldToTab("Root.Main", UploadField::create('MetaImage', 'Summary image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription('Choose an image to represent this page in listings and on social media.'), "Content"); }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab('Root.Main', array(TextField::create('Intro', 'Introduction'), TextAreaField::create('CTA', 'Call To Action')), 'Content'); $fields->addFieldsToTab('Root.Story', array(TextField::create('StoryTitle', 'Story Title'), TextField::create('StorySubheading', 'Story Subheading'), TextAreaField::create('StoryContent', 'Story Content'), $upload = UploadField::create('StoryImage', 'Story Image'))); $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif')); $upload->setFolderName('homepage-story'); return $fields; }
/** * Setup the fields for the frontend * @param type $params * @return FieldList $fields the default FieldList */ public function getFrontEndFields($params = null) { $fields = parent::getFrontEndFields($params); $fields->removeByName(array('MD5Email', 'AkismetMarked', 'Visible', 'ShowGravatar', 'News')); $fields->replaceField('Email', EmailField::create('Email', $this->fieldLabel('Email'))); $fields->replaceField('Comment', TextAreaField::create('Comment', $this->fieldLabel('Comment'))); $fields->fieldByName('Comment')->setColumns(20)->setRows(10); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Content'); $fields->removeByName('Metadata'); $fields->addFieldToTab('Root.Main', TextField::create('Factheading', 'Fact heading'), 'Content'); $fields->addFieldToTab('Root.Main', TextAreaField::create('Fact', 'Fun Fact'), 'Content'); return $fields; }
public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab('Root.Main', UploadField::create('Logo')->setFolderName('logos')); $footer_fields = ToggleCompositeField::create('FoooterInfo', 'Footer', array(HTMLEditorField::create('FooterContent', 'Content to appear in footer')->setRows(15)->addExtraClass('stacked')))->setHeadingLevel(4); $contact_fields = ToggleCompositeField::create('ContactInfo', 'Contact Info.', array(TextAreaField::create('ContactAddress', $this->owner->fieldLabel('ContactAddress')), TextField::create('ContactEmail', $this->owner->fieldLabel('ContactEmail')), TextField::create('ContactPhone', $this->owner->fieldLabel('ContactPhone')), TextAreaField::create('MiscContactInfo', $this->owner->fieldLabel('MiscContactInfo')), TextAreaField::create('MapHTML', "HTML to be loaded for mapping info")))->setHeadingLevel(4); $theme_custom_fields = ToggleCompositeField::create('CustomTheme', 'Theme Customisation', array(TextField::create('CustomMainBackground', $this->owner->fieldLabel('CustomMainBackground')), TextField::create('CustomBodyBackground', $this->owner->fieldLabel('CustomBodyBackground')), TextField::create('CustomHeadBackground', $this->owner->fieldLabel('CustomHeadBackground')), TextField::create('CustomFootBackground', $this->owner->fieldLabel('CustomFootBackground')), TextField::create('CustomMaxWidth', $this->owner->fieldLabel('CustomMaxWidth'))))->setHeadingLevel(4); $fields->addFieldToTab('Root.Main', $footer_fields); $fields->addFieldToTab('Root.Main', $contact_fields); $fields->addFieldToTab('Root.Main', $theme_custom_fields); }
/** * Add and re-arrange CMS fields for streamlined summary editing. */ public function updateCMSFields(FieldList $fields) { // Remove all Meta fields $fields->removeByName('Metadata'); // Add summary fields $fields->addFieldToTab('Root.Main', TextAreaField::create('MetaDescription', 'Content summary')->setDescription('Summarise the content of this page. This will be used for search engine results and social media so make it enticing.')->setAttribute('placeholder', $this->owner->getDefaultOGDescription())->setRows(2), 'Content'); $imgFieldDescription = 'Choose an image to represent this page in listings and on social media.'; if (!$this->owner->MetaImageID && $this->owner->isPublished()) { $imgFieldDescription .= " <i style=\"color:#ec720f\">For best results, please don't leave this empty.</i>"; } $fields->addFieldToTab('Root.Main', UploadField::create('MetaImage', 'Summary image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription($imgFieldDescription), 'Content'); }
public function __construct($controller, $name, $discussion = null) { // Get member and upload path $member = Member::currentUser(); $fields = new FieldList(HiddenField::create("ID"), TextField::create("Title", _t("Discussions.GiveTitle", "Give your discussion a title")), TextAreaField::create("Content", _t("Discussions.AddContent", "And some content (optional)")), TextField::create("Tags", _t("Discussions.AddTags", "Finally, add some tags (optional)"))->setAttribute("placeholder", "Tag 1, Tag 2")); if ($controller->Categories()->exists()) { $fields->add(CheckboxsetField::create("Categories", _t("Discussions.Categories", "Or Post this under a category? (optional)"), $controller->Categories()->map())); } $actions = new FieldList(FormAction::create("post")->setTitle(_t("Discussions.Post", "Post"))); $validator = new RequiredFields("Title", "Content"); parent::__construct($controller, $name, $fields, $actions, $validator); }
/** * Add CMS fields to allow setting of custom open graph values. */ public function updateCMSFields(FieldList $fields) { $msg = Config::inst()->get('ShareCareFields', 'cms_message'); if ($msg) { $fields->addFieldToTab('Root.Share', new LiteralField('ShareCareFieldsMessage', '<div class="message notice"><p>' . $msg . '</p></div>')); } $fields->addFieldToTab('Root.Share', TextField::create('OGTitleCustom', 'Share title')->setAttribute('placeholder', $this->owner->getDefaultOGTitle())->setMaxLength(90)); $fields->addFieldToTab('Root.Share', TextAreaField::create('OGDescriptionCustom', 'Share description')->setAttribute('placeholder', $this->owner->getDefaultOGDescription())->setRows(2)); $fields->addFieldToTab('Root.Share', UploadField::create('OGImageCustom', 'Share image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription('<a href="https://developers.facebook.com/docs/sharing/best-practices#images" target="_blank">Optimum image ratio</a> is 1.91:1. (1200px wide by 630px tall or better)')); if (Config::inst()->get('ShareCare', 'pinterest')) { $fields->addFieldToTab('Root.Share', UploadField::create('PinterestImageCustom', 'Pinterest image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription('Square/portrait or taller images look best on Pinterest. This image should be at least 750px wide.')); } }
public function updateCMSFields(FieldList $fields) { $fields->removeByName('ContactEmail'); $fields->removeByName('ContactPhone'); // Ecommerce Fields // Compress default commerce settings $contact_fields = ToggleCompositeField::create('ContactDetails', 'Contact Details', array(TextField::create('ContactEmail', 'Email Address'), TextField::create('ContactPhone', 'Phone Number')))->setHeadingLevel(4); // Compress default commerce settings $settings_fields = ToggleCompositeField::create('CommerceSettings', 'Default Settings', array(TextField::create('OrderPrefix', 'Short code that can appear at the start of order numbers', null, 9), DropdownField::create('CurrencyID', 'Currency to use', CommerceCurrency::get()->map(), $this->owner->CurrencyID)->setEmptyString('Please Select'), DropdownField::create('WeightID', 'Weight to use', ProductWeight::get()->map(), $this->owner->WeightID)->setEmptyString('Please Select'), UploadField::create('NoProductImage', 'Overwrite default "image unavailable" image')))->setHeadingLevel(4); // Compress shopping cart settings $cart_fields = ToggleCompositeField::create('CartProcess', 'Cart and Checkout Content', array(HtmlEditorField::create('CartCopy', 'Shopping cart')->setRows(15)->addExtraClass('stacked'), TextAreaField::create('SuccessCopy', 'Order success page')->setRows(4)->setColumns(30)->addExtraClass('stacked'), TextAreaField::create('FailerCopy', 'Order failer page')->setRows(4)->setColumns(30)->addExtraClass('stacked')))->setHeadingLevel(4); // Compress email alerts $email_fields = ToggleCompositeField::create('EmailAlerts', 'Email Alerts', array(TextField::create('EmailFromAddress', 'Send commerce notifications from?'), LiteralField::create('OrderPlacedHeader', '<div class="field"><h4>When an order is placed</h4></div>'), DropdownField::create('SendPaidEmail', 'Send emails to', $this->owner->dbObject('SendPaidEmail')->enumValues()), TextField::create('PaidEmailAddress', 'Vendor address'), LiteralField::create('OrderFailedHeader', '<div class="field"><h4>When an order fails</h4></div>'), DropdownField::create('SendFailedEmail', 'Send emails to', $this->owner->dbObject('SendPaidEmail')->enumValues()), TextField::create('FailedEmailAddress', 'Vendor address'), LiteralField::create('OrderProcessingHeader', '<div class="field"><h4>When an order is marked as processing</h4></div>'), DropdownField::create('SendProcessingEmail', 'Send emails to', $this->owner->dbObject('SendProcessingEmail')->enumValues()), TextField::create('ProcessingEmailAddress', 'Vendor address'), LiteralField::create('OrderPlacedHeader', '<div class="field"><h4>When an order is marked as dispatched</h4></div>'), DropdownField::create('SendDispatchedEmail', 'Send emails to', $this->owner->dbObject('SendDispatchedEmail')->enumValues()), TextField::create('DispatchedEmailAddress', 'Vendor address'), LiteralField::create('FooterContent', '<div class="field"><h4>Footer Content</h4></div>'), TextareaField::create('VendorEmailFooter', 'Add custom content to the footer of vendor emails?')))->setHeadingLevel(4); // Add html description of how to edit contries $country_html = "<div class=\"field\">"; $country_html .= "<p>First select valid countries using the 2 character "; $country_html .= "shortcode (see http://fasteri.com/list/2/short-names-of-countries-and-iso-3166-codes).</p>"; $country_html .= "<p>You can add multiple countries seperating them with"; $country_html .= "a comma or use a '*' for all countries.</p>"; $country_html .= "</div>"; $country_html_field = LiteralField::create("CountryDescription", $country_html); // Deal with product features $postage_field = new GridField('PostageAreas', '', $this->owner->PostageAreas(), GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddNewInlineButton('toolbar-header-left'))); // Add country dropdown to inline editing $postage_field->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'TextField'), 'Country' => array('title' => 'ISO 3166 codes', 'field' => 'TextField'), 'ZipCode' => array('title' => 'Zip/Post Codes', 'field' => 'TextField'), 'Calculation' => array('title' => 'Base unit', 'callback' => function ($record, $column, $grid) { return DropdownField::create($column, "Based on", singleton('PostageArea')->dbObject('Calculation')->enumValues())->setValue("Weight"); }), 'Unit' => array('title' => 'Unit (equals or above)', 'field' => 'NumericField'), 'Cost' => array('title' => 'Cost', 'field' => 'NumericField'))); // Setup compressed postage options $postage_fields = ToggleCompositeField::create('PostageFields', 'Postage Options', array($country_html_field, $postage_field)); // Setup compressed postage options $discounts_fields = ToggleCompositeField::create('DiscountFields', 'Discounts', array(GridField::create('Discounts', '', $this->owner->Discounts(), GridFieldConfig_RecordEditor::create()))); // Payment Methods $payment_table = GridField::create('PaymentMethods', 'CommercePaymentMethod', $this->owner->PaymentMethods(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm())); // setup compressed payment options $payment_fields = ToggleCompositeField::create('PaymentFields', 'Payment Options', array($payment_table)); // Compress tax fields $tax_fields = ToggleCompositeField::create('TaxDetails', 'Tax', array(NumericField::create('TaxRate'), TextField::create("TaxName", "Name of your tax (EG 'VAT')"), CheckboxField::create('TaxPriceInclude', 'Show price including tax?')))->setHeadingLevel(4); // Add config sets $fields->addFieldToTab('Root.Commerce', $contact_fields); $fields->addFieldToTab('Root.Commerce', $settings_fields); $fields->addFieldToTab('Root.Commerce', $cart_fields); $fields->addFieldToTab('Root.Commerce', $email_fields); $fields->addFieldToTab('Root.Commerce', $postage_fields); $fields->addFieldToTab('Root.Commerce', $discounts_fields); $fields->addFieldToTab('Root.Commerce', $payment_fields); $fields->addFieldToTab('Root.Commerce', $tax_fields); }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByname('ParentID'); $fields->removeByname('MapLocationHelp'); $fields->removeByname('Address'); $fields->removeByname('PostCode'); $fields->removeByname('Latitude'); $fields->removeByname('Longitude'); $fields->removeByname('ZoomLevel'); $fields->removeByname('Content'); if ($this->ID) { $fields->addFieldToTab("Root.Main", HtmlEditorField::create("Content", "Content to be displayed with this map")->addExtraClass('stacked')->setRows(15)); $config_fields = ToggleCompositeField::create('MapConfig', 'Configuration Options', array(LiteralField::create('MapLocationHelp', '<p class="field">Set EITHER an address / post code OR latitude / longitude to generate a map</p>'), TextAreaField::create("Address"), TextField::create("PostCode", "Post Code"), TextField::create("Latitude"), TextField::create("Longitude"), NumericField::create("ZoomLevel", "Zoom (1 = world, 20 = close)")))->setHeadingLevel(4); $fields->addFieldToTab('Root.Main', $config_fields); } return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $languageField = DropdownField::create('Language', 'Language', array('af' => 'Afrikaans', 'sq' => 'Albanian', 'eu' => 'Basque', 'be' => 'Belarusian', 'bg' => 'Bulgarian', 'ca' => 'Catalan', 'zh-cn' => 'Chinese (Simplified)', 'zh-tw' => 'Chinese (Traditional)', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'nl' => 'Dutch', 'nl-be' => 'Dutch (Belgium)', 'nl-nl' => 'Dutch (Netherlands)', 'en' => 'English', 'en-au' => 'English (Australia)', 'en-bz' => 'English (Belize)', 'en-ca' => 'English (Canada)', 'en-ie' => 'English (Ireland)', 'en-jm' => 'English (Jamaica)', 'en-nz' => 'English (New Zealand)', 'en-ph' => 'English (Phillipines)', 'en-za' => 'English (South Africa)', 'en-tt' => 'English (Trinidad)', 'en-gb' => 'English (United Kingdom)', 'en-us' => 'English (United States)', 'en-zw' => 'English (Zimbabwe)', 'et' => 'Estonian', 'fo' => 'Faeroese', 'fi' => 'Finnish', 'fr' => 'French', 'fr-be' => 'French (Belgium)', 'fr-ca' => 'French (Canada)', 'fr-fr' => 'French (France)', 'fr-lu' => 'French (Luxembourg)', 'fr-mc' => 'French (Monaco)', 'fr-ch' => 'French (Switzerland)', 'gl' => 'Galician', 'gd' => 'Gaelic', 'de' => 'German', 'de-at' => 'German (Austria)', 'de-de' => 'German (Germany)', 'de-li' => 'German (Liechtenstein)', 'de-lu' => 'German (Luxembourg)', 'de-ch' => 'German (Switzerland)', 'el' => 'Greek', 'haw' => 'Hawaiian', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'in' => 'Indonesian', 'ga' => 'Irish', 'it' => 'Italian', 'it-it' => 'Italian (Italy)', 'it-ch' => 'Italian (Switzerland)', 'ja' => 'Japanese', 'ko' => 'Korean', 'mk' => 'Macedonian', 'no' => 'Norwegian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'pt-br' => 'Portuguese (Brazil)', 'pt-pt' => 'Portuguese (Portugal)', 'ro' => 'Romanian', 'ro-mo' => 'Romanian (Moldova)', 'ro-ro' => 'Romanian (Romania)', 'ru' => 'Russian', 'ru-mo' => 'Russian (Moldova)', 'ru-ru' => 'Russian (Russia)', 'sr' => 'Serbian', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'es' => 'Spanish', 'es-ar' => 'Spanish (Argentina)', 'es-bo' => 'Spanish (Bolivia)', 'es-cl' => 'Spanish (Chile)', 'es-co' => 'Spanish (Colombia)', 'es-cr' => 'Spanish (Costa Rica)', 'es-do' => 'Spanish (Dominican Republic)', 'es-ec' => 'Spanish (Ecuador)', 'es-sv' => 'Spanish (El Salvador)', 'es-gt' => 'Spanish (Guatemala)', 'es-hn' => 'Spanish (Honduras)', 'es-mx' => 'Spanish (Mexico)', 'es-ni' => 'Spanish (Nicaragua)', 'es-pa' => 'Spanish (Panama)', 'es-py' => 'Spanish (Paraguay)', 'es-pe' => 'Spanish (Peru)', 'es-pr' => 'Spanish (Puerto Rico)', 'es-es' => 'Spanish (Spain)', 'es-uy' => 'Spanish (Uruguay)', 'es-ve' => 'Spanish (Venezuela)', 'sv' => 'Swedish', 'sv-fi' => 'Swedish (Finland)', 'sv-se' => 'Swedish (Sweden)', 'tr' => 'Turkish', 'uk' => 'Ukranian')); $languageField->setHasEmptyDefault(true)->setEmptyString('Select Language'); $podcastImage = UploadField::create('PodcastImage', 'Podcast Image'); $podcastImage->setFolderName('podcast/podcast-artwork')->setDescription("iTunes recommends a size of at least 1400x1400")->getValidator()->setAllowedExtensions(array('jpg', 'png')); $completeField = CheckboxField::create('Complete'); $completeField->setDescription('This podcast is complete. No more episodes will be added to the podcast.'); $blockField = CheckboxField::create('Block'); $blockField->setDescription('Prevent the <strong>entire</strong> podcast from appearing in the iTunes podcast directory.'); $explicitField = DropdownField::create('Explicit', 'Explicit', $this->dbObject('Explicit')->enumValues()); $explicitField->setDescription("Displays an 'Explicit', 'Clean' or no parental advisory graphic next to your podcast artwork in iTunes."); $fields->addFieldsToTab('Root.Podcast', array(TextField::create('PodcastTitle', 'Podcast Title'), TextField::create('Subtitle'), $languageField, TextField::create('Author'), TextAreaField::create('Summary'), TextField::create('OwnerName', 'Owner Name'), EmailField::create('OwnerEmail', 'Owner Email'), TextField::create('Copyright'), $completeField, $blockField, $explicitField, TextAreaField::create('Categories'), $podcastImage)); $config = GridFieldConfig_RelationEditor::create(); $episodesTable = GridField::create('PodcastEpisodes', 'Podcast Episodes', $this->PodcastEpisodes()->sort('EpisodeDate', 'DESC'), $config); $fields->addFieldToTab('Root.Episodes', $episodesTable); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); //Main Content标签页 //将类型添加到admin中页面编辑选项中,并排在Content选项之前显示 $fields->addFieldToTab('Root.Main', DateField::create('Date', 'Date of the article')->setConfig('showcalendar', true), 'Content'); //第二个参数是解释文字,代替真实类型名显示在网页上 $fields->addFieldToTab('Root.Main', TextAreaField::create('Teaser'), 'Content'); $fields->addFieldToTab('Root.Main', TextField::create('Author', 'Author of the article')->setDescription('If mulitple authors,separate with commas')->setMaxLength(50), 'Content'); //Attachment标签页 $fields->addFieldToTab('Root.Attachments', $photo = UploadField::create('Photo')); $fields->addFieldToTab('Root.Attachments', $brochure = UploadField::create('Brochure', 'Travel brochure, optional (pdf only)')); $photo->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg')); $photo->setFolderName('travel-photos'); $brochure->getValidator()->setAllowedExtensions(array('pdf')); $brochure->setFolderName('travel-brochures'); //Categories标签页 $fields->addFieldToTab('Root.Categories', CheckBoxSetField::create('Categories', 'Select categories', $this->Parent()->Categories()->map('ID', 'Title'))); return $fields; }
public function ContactForm() { $form = BootstrapForm::create($this, __FUNCTION__, FieldList::create(TextField::create('FullName', 'Full Name'), TextField::create('Phone', 'Phone Number'), TextField::create('Email', 'Email Address'), TextAreaField::create('Message', 'Message')), Fieldlist::create(FormAction::create('sendContactForm', 'Send Message')->addExtraClass('square-btn'))); return $form; }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { $helpText = LiteralField::create('ContentReviewHelp', _t('ContentReview.DEFAULTSETTINGSHELP', 'These content review settings will apply to all pages that does not have specific Content Review schedule.')); $fields->addFieldToTab('Root.ContentReview', $helpText); $reviewFrequency = DropdownField::create('ReviewPeriodDays', _t('ContentReview.REVIEWFREQUENCY', 'Review frequency'), SiteTreeContentReview::get_schedule())->setDescription(_t('ContentReview.REVIEWFREQUENCYDESCRIPTION', 'The review date will be set to this far in the future whenever the page is published')); $fields->addFieldToTab('Root.ContentReview', $reviewFrequency); $users = Permission::get_members_by_permission(array('CMS_ACCESS_CMSMain', 'ADMIN')); $usersMap = $users->map('ID', 'Title')->toArray(); asort($usersMap); $userField = ListboxField::create('OwnerUsers', _t('ContentReview.PAGEOWNERUSERS', 'Users'), $usersMap)->setMultiple(true)->setAttribute('data-placeholder', _t('ContentReview.ADDUSERS', 'Add users'))->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews')); $fields->addFieldToTab('Root.ContentReview', $userField); $groupsMap = array(); foreach (Group::get() as $group) { // Listboxfield values are escaped, use ASCII char instead of » $groupsMap[$group->ID] = $group->getBreadcrumbs(' > '); } asort($groupsMap); $groupField = ListboxField::create('OwnerGroups', _t('ContentReview.PAGEOWNERGROUPS', 'Groups'), $groupsMap)->setMultiple(true)->setAttribute('data-placeholder', _t('ContentReview.ADDGROUP', 'Add groups'))->setDescription(_t('ContentReview.OWNERGROUPSDESCRIPTION', 'Page owners that are responsible for reviews')); $fields->addFieldToTab('Root.ContentReview', $groupField); $FirstReviewDaysBefore = NumericField::create('FirstReviewDaysBefore', _t('ContentReview.FIRSTREVIEWDAYSBEFORE', 'First review reminder # days before final review')); $SecondReviewDaysBefore = NumericField::create('SecondReviewDaysBefore', _t('ContentReview.SECONDREVIEWDAYSBEFORE', 'Second review reminder # days before final review')); // Email content $fields->addFieldsToTab('Root.ContentReview', array(TextField::create('ReviewFrom', _t('ContentReview.EMAILFROM', 'From email address'))->setRightTitle(_t('Review.EMAILFROM_RIGHTTITLE', 'e.g: do-not-reply@site.com')), $FirstReviewDaysBefore, $SecondReviewDaysBefore, TextField::create('ReviewReminderEmail', 'Review reminder email address')->setRightTitle('e.g: review.reminders@site.com'), TextField::create('ReviewSubjectReminder', _t('ContentReview.EMAILSUBJECTREMINDER', 'Subject line - reminder')), TextField::create('ReviewSubject', _t('ContentReview.EMAILSUBJECT', 'Subject line - Review due')), TextAreaField::create('ReviewBodyFirstReminder', _t('ContentReview.EMAILTEMPLATEFIRSTREMINDER', 'Email body - First reminder')), TextAreaField::create('ReviewBodySecondReminder', _t('ContentReview.EMAILTEMPLATESECONDREMINDER', 'Email body - Second reminder')), TextAreaField::create('ReviewBody', _t('ContentReview.EMAILTEMPLATE', 'Email body - Review due')), LiteralField::create('TemplateHelp', $this->owner->renderWith('ContentReviewAdminHelp')))); }
public function updateCMSFields(FieldList $fields) { $fields->removeByName(array('MetaTitle', 'OGTitle', 'MetaDescription', 'OGDescription', 'OGImage')); $fields->addFieldsToTab('Root.Meta', array(LiteralField::create('Message', '<div class="message warning">Fallback data may be provided for each of the fields below if left blank.</div>'), TextField::create('MetaTitle')->setTitle('Meta Title'), TextField::create('OGTitle')->setTitle('OG Title'), TextAreaField::create('MetaDescription')->setTitle('Meta Description'), TextAreaField::create('OGDescription')->setTitle('OG Description'), UploadField::create('OGImage')->setTitle('OG Image')->setFolderName('Meta'))); }
/** * @param FieldList $fields * @return Object */ public function updateCMSFields(FieldList $fields) { $fields->addFieldsToTab('Root.Main', ToggleCompositeField::create('Twitter Graph', 'Twitter Card', array(LiteralField::create('', '<h2> Twitter Card <img style="position:relative;top:4px;left 4px;" src="' . Director::absoluteBaseURL() . 'twitter-card-meta/Images/twitter.png"></h2>'), TextField::create('TwitterSite', 'Site Handle')->setAttribute('placeholder', 'e.g @sitename')->setRightTitle('Twitter account name for the site'), TextField::create('TwitterCreator', 'Creator Handle')->setAttribute('placeholder', 'e.g @username')->setRightTitle('Twitter account name for the author/creator (Will default to site handle)'), OptionsetField::create('TwitterCardType', 'Twitter Card Type', array('summary_large_image' => 'summary with large image', 'summary' => 'summary'), 'summary_large_image')->setRightTitle('Choose which type of twitter card you would like this page to share as.'), TextField::create('TwitterTitle', 'Twitter Card Title')->setAttribute('placeholder', 'e.g Description Of Page Content')->setRightTitle('Twitter title to to display on the Twitter card'), TextAreaField::create('TwitterDescription', '')->setRightTitle('Twitter card description goes here, automatically defaults to the content summary'), UploadField::create('TwitterImage', 'Twitter Card Image')->setRightTitle('Will default too the first image in the WYSIWYG editor or banner image if left blank')))); }
public function updateCMSFields(FieldList $fields) { if ($this->owner->ClassName != 'Folder') { $fields->addFieldToTab('Root.Main', TextAreaField::create('Description')); } }
/** * @param FieldList $fields * @return Object */ public function updateCMSFields(FieldList $fields) { $fields->addFieldsToTab('Root.Main', ToggleCompositeField::create('Open graph', 'Open graph', array(LiteralField::create('', '<h2> Open Graph Information <img style="position:relative;top:8px;" src="' . Director::absoluteBaseURL() . 'open-graph-meta/Images/opengraph.png"></h2>'), TextField::create('OGTitle', '')->setAttribute('placeholder', 'e.g My Website')->setRightTitle('Page title goes here, automatically defaults to the page title'), TextField::create('OGUrl', '')->setAttribute('placeholder', 'http://www.mywebsite.com/')->setRightTitle('Page URL goes here, automatically defaults to the page URL (shouldn\'t need overwriting)'), DropdownField::create('OGContent', 'Content Type', array('website' => 'website', 'article' => 'article', 'blog' => 'blog', 'product' => 'product', 'profile' => 'profile', 'video' => 'video', 'place' => 'place'), 'website')->setRightTitle('Will default to website (the most common open graph object type'), TextAreaField::create('OGDescription', '')->setRightTitle('Page description goes here, automatically defaults to the content summary'), UploadField::create('OGImage', 'Open Graph Image')))); }
public function CommentForm() { $form = BootstrapForm::create($this, __FUNCTION__, Fieldlist::create(TextField::create('Name', '')->setAttribute('placeholder', 'Name'), TextAreaField::create('Comment', '')->setAttribute('placeholder', 'Type You Comment Here')), FieldList::create(FormAction::create('handleComment', 'Post Comment')->setStyle('primary')->addExtraClass('btn square-btn')), RequiredFields::create('Name', 'Comment')); return $form; }