public function __construct($controller, $name, $order) { /* Store Settings Object */ $conf = StoreSettings::get_settings(); /* Comments Box, if enabled */ if ($conf->CheckoutSettings_OrderComments) { $comments = TextareaField::create("CustomerComments", "Order Comments"); $comments->setRightTitle("These comments will be seen by staff."); } else { $comments = HiddenField::create("CustomerComments", ""); } /* Terms and Conditions, if enabled */ if ($conf->CheckoutSettings_TermsAndConditions) { $terms = CheckboxField::create("Terms", "I agree to " . $conf->StoreSettings_StoreName . "'s " . "<a href=" . DataObject::get_by_id("SiteTree", $conf->CheckoutSettings_TermsAndConditionsSiteTree)->URLSegment . ">" . "Terms & Conditions</a>."); } else { $terms = HiddenField::create("Terms", ""); } /* Fields */ $fields = FieldList::create($comments, OptionsetField::create("PaymentMethod", "Payment Method", Gateway::create()->getGateways($order)), $terms ? HeaderField::create("Terms and Conditions", 5) : HiddenField::create("TermsHeaderField", ""), $terms); /* Actions */ $actions = FieldList::create(FormAction::create('payment', 'Place Order & Continue to Payment')); /* Required Fields */ $required = new RequiredFields(array("PaymentMethod", $terms ? "Terms" : null)); /* * Now we create the actual form with our fields and actions defined * within this class. */ return parent::__construct($controller, $name, $fields, $actions, $required); }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab("Root.Main", array(TextareaField::create('Content', 'Content'), UploadField::create('PreviewImage', 'Image')), 'Type'); $fields->addFieldsToTab("Root.Main", array(TextField::create('ReadMore', 'Read more'))); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab("Root.Main", array(OptionsetField::create('Status', 'Status', array("1" => "Active", "0" => "Disabled"), 1), TextField::create('AdminTitle')->setDescription('This field is for adminisration use only and will not display on the site.'), TextareaField::create('Title', 'Title')->setRows(2), HtmlEditorField::create('Content', 'Content'))); $this->extend('updateCMSFields', $fields); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TextField::create('FeaturedTitle', 'Featured Heading'), 'Content'); $fields->addFieldToTab('Root.Main', TextareaField::create('FeaturedContent', 'Featured Content'), 'Content'); return $fields; }
public function getCMSFields() { $fields = FieldList::create(TextField::create('Title'), TextField::create('Copyright'), TextareaField::create('Caption'), $imageField = UploadField::create('Attachment')); $imageField->setAllowedFileCategories('image'); $imageField->setAllowedMaxFileNumber(1); return $fields; }
/** * @return FieldList */ public function getCMSFields() { // Get NotifiedOn implementors $types = ClassInfo::implementorsOf('NotifiedOn'); $types = array_combine($types, $types); unset($types['NotifyOnThis']); if (!$types) { $types = array(); } array_unshift($types, ''); // Available keywords $keywords = $this->getKeywords(); if (count($keywords)) { $availableKeywords = '<div class="field"><div class="middleColumn"><p><u>Available Keywords:</u> </p><ul><li>$' . implode('</li><li>$', $keywords) . '</li></ul></div></div>'; } else { $availableKeywords = "Available keywords will be shown if you select a NotifyOnClass"; } // Identifiers $identifiers = $this->config()->get('identifiers'); if (count($identifiers)) { $identifiers = array_combine($identifiers, $identifiers); } $fields = FieldList::create(); $relevantMsg = 'Relevant for (note: this notification will only be sent if the context of raising the notification is of this type)'; $fields->push(TabSet::create('Root', Tab::create('Main', DropdownField::create('Identifier', _t('SystemNotification.IDENTIFIER', 'Identifier'), $identifiers), TextField::create('Title', _t('SystemNotification.TITLE', 'Title')), TextField::create('Description', _t('SystemNotification.DESCRIPTION', 'Description')), DropdownField::create('NotifyOnClass', _t('SystemNotification.NOTIFY_ON_CLASS', $relevantMsg), $types), TextField::create('CustomTemplate', _t('SystemNotification.TEMPLATE', 'Template (Optional)'))->setAttribute('placeholder', $this->config()->get('default_template')), LiteralField::create('AvailableKeywords', $availableKeywords)))); if ($this->config()->html_notifications) { $fields->insertBefore(HTMLEditorField::create('NotificationHTML', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords'); } else { $fields->insertBefore(TextareaField::create('NotificationText', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords'); } return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TextField::create('ShowCaseIcon', 'Showcase Icon'), 'Content'); $fields->addFieldToTab('Root.Main', TextareaField::create('ShowCaseTeaser', 'Showcase Teaser'), 'Content'); return $fields; }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { /** ========================================= * @var TextareaField $address * @var TextareaField $postalAddress * @var TextField $mailChimpAPI * @var TextareaField $mailChimpSuccessMessage ===========================================*/ if (!$fields->fieldByName('Root.Settings')) { $fields->addFieldToTab('Root', TabSet::create('Settings')); } /** ----------------------------------------- * Details * ----------------------------------------*/ $address = TextareaField::create('Address', 'Address'); $address->setRows(8); $postalAddress = TextareaField::create('PostalAddress', 'Postal Address'); $postalAddress->setRows(8); $fields->findOrMakeTab('Root.Settings.Details'); $fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('', 'Company Details'), Textfield::create('Phone', 'Phone Number'), Textfield::create('Email', 'Public Email Address'), $address, $postalAddress, TextField::create('Facebook', 'Facebook'), TextField::create('LinkedIn', 'LinkedIn'), TextField::create('Pinterest', 'Pinterest'), TextField::create('TwitterHandle', 'Twitter Handle'))); /** ----------------------------------------- * Subscription * ----------------------------------------*/ $mailChimpAPI = TextField::create('MailChimpAPI', 'API Key'); $mailChimpSuccessMessage = TextareaField::create('MailChimpSuccessMessage', 'Success Message (optional)'); $mailChimpAPI->setRightTitle('<a href="https://us9.admin.mailchimp.com/account/api-key-popup/" target="_blank"><i>How do I get my MailChimp API Key?</i></a>'); $mailChimpSuccessMessage->setRows(2)->setRightTitle('Message displayed when a user has successfully subscribed to a list.'); $fields->findOrMakeTab('Root.Settings.Subscription', 'Subscription'); $fields->addFieldsToTab('Root.Settings.Subscription', array(HeaderField::create('', 'Newsletter Subscription'), LiteralField::create('', '<p>The API key, and list ID are necessary for the Newsletter Subscription form to function.</p>'), $mailChimpAPI, TextField::create('MailChimpListID', 'List ID'), $mailChimpSuccessMessage)); }
public function getCMSFields() { $fields = parent::getCMSFields(); $subsites = DataObject::get('Subsite'); if (!$subsites) { $subsites = new ArrayList(); } else { $subsites = ArrayList::create($subsites->toArray()); } $subsites->push(new ArrayData(array('Title' => 'Main site', 'ID' => 0))); $fields->addFieldToTab('Root.Main', DropdownField::create("CopyContentFromID_SubsiteID", _t('SubsitesVirtualPage.SubsiteField', "Subsite"), $subsites->map('ID', 'Title'))->addExtraClass('subsitestreedropdownfield-chooser no-change-track'), 'CopyContentFromID'); // Setup the linking to the original page. $pageSelectionField = new SubsitesTreeDropdownField("CopyContentFromID", _t('VirtualPage.CHOOSE', "Choose a page to link to"), "SiteTree", "ID", "MenuTitle"); if (Controller::has_curr() && Controller::curr()->getRequest()) { $subsiteID = Controller::curr()->getRequest()->requestVar('CopyContentFromID_SubsiteID'); $pageSelectionField->setSubsiteID($subsiteID); } $fields->replaceField('CopyContentFromID', $pageSelectionField); // Create links back to the original object in the CMS if ($this->CopyContentFromID) { $editLink = "admin/pages/edit/show/{$this->CopyContentFromID}/?SubsiteID=" . $this->CopyContentFrom()->SubsiteID; $linkToContent = "\n\t\t\t\t<a class=\"cmsEditlink\" href=\"{$editLink}\">" . _t('VirtualPage.EDITCONTENT', 'Click here to edit the content') . "</a>"; $fields->removeByName("VirtualPageContentLinkLabel"); $fields->addFieldToTab("Root.Main", $linkToContentLabelField = new LabelField('VirtualPageContentLinkLabel', $linkToContent), 'Title'); $linkToContentLabelField->setAllowHTML(true); } $fields->addFieldToTab('Root.Main', TextField::create('CustomMetaTitle', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')), 'MetaTitle'); $fields->addFieldToTab('Root.Main', TextareaField::create('CustomMetaKeywords', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'MetaKeywords'); $fields->addFieldToTab('Root.Main', TextareaField::create('CustomMetaDescription', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'MetaDescription'); $fields->addFieldToTab('Root.Main', TextField::create('CustomExtraMeta', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'ExtraMeta'); return $fields; }
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 & 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 & 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; }
public function updateCMSFields(FieldList $fields) { $fields->removeByName('Theme'); $fields->addFieldsToTab('Root.Main', array(TextField::create('Email', 'Email Address')->setAttribute("placeholder", "*****@*****.**"), TextField::create('Phone', 'Phone Number'), TextField::create('FreePhone', 'Free Phone Number'), TextField::create('Mobile', 'Mobile Number'), TextField::create('Fax', 'Fax Number'), TextField::create('FacebookURL', 'Facebook URL')->setAttribute("placeholder", "http://www.facebook.com"), TextField::create('TwitterURL', 'Twitter URL')->setAttribute("placeholder", "http://www.twitter.com"), TextField::create('PinterestURL', 'Pinterest URL')->setAttribute("placeholder", "http://www.pinterest.com"), TextField::create('InstagramURL', 'Instagram URL')->setAttribute("placeholder", "http://www.instagram.com"), TextField::create('LinkedInURL', 'LinkedIn URL')->setAttribute("placeholder", "http://www.linkedin.com"), TextField::create('YoutubeURL', 'Youtube URL')->setAttribute("placeholder", "http://www.youtube.com"), TextareaField::create('PostalAddress', 'Postal Address')->setRows(4), TextareaField::create('PhysicalAddress', 'Physical Address')->setRows(4))); $fields->addFieldsToTab('Root.Plato', array(TextField::create('GoogleTagManager', 'Enter the Tag Manager ID'))); return $fields; }
public function updateCMSFields(FieldList $fields) { $fields->insertBefore(new Tab('MembershipDetails', 'Membership Details'), 'Main'); //move first and ;astname $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('FirstName')); $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Surname')); $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Email')); $fields->addFieldToTab('Root.MembershipDetails', $region = DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title'))); $region->setEmptyString(' '); $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('MembershipStatus', 'Membership Status', $this->owner->dbObject('MembershipStatus')->enumValues())); $fields->addFieldToTab('Root.MembershipDetails', $expiry = DateField::create('ExpiryDate')); $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('Discount', 'Discount', $this->owner->dbObject('Discount')->enumValues())); $fields->addFieldToTab('Root.MembershipDetails', $discountExpiry = DateField::create('DiscountExpiryDate')); $fields->addFieldToTab('Root.MembershipDetails', $joined = DateField::create('JoinedDate')); $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('NotesForMember')); if ($this->owner->MembershipStatus !== "Not applied") { $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MemberNumber')); } $fields->addFieldToTab('Root.MembershipDetails', TextField::create('HomePhone')); $fields->addFieldToTab('Root.MembershipDetails', TextField::create('WorkPhone')); $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MobilePhone')); $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('Address')); $fields->addFieldToTab('Root.MembershipDetails', TextField::create('Occupation')); $fields->addFieldToTab('Root.MembershipDetails', TextField::create('BirthDate')); $expiry->setConfig('showcalendar', true); $expiry->setConfig('showdropdown', true); $expiry->setConfig('dateformat', 'dd-MM-YYYY'); $discountExpiry->setConfig('showcalendar', true); $discountExpiry->setConfig('showdropdown', true); $discountExpiry->setConfig('dateformat', 'dd-MM-YYYY'); $joined->setConfig('showcalendar', true); $joined->setConfig('showdropdown', true); $joined->setConfig('dateformat', 'dd-MM-YYYY'); }
/** * 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; }
public function getCMSFields() { $conf = SiteConfig::current_site_config(); $themes = $conf->getAvailableThemes(); $theme = new DropdownField('Theme', _t('Multisites.THEME', 'Theme'), $themes); $theme->setEmptyString(_t('Multisites.DEFAULTTHEME', '(Default theme)')); $fields = new FieldList(new TabSet('Root', new Tab('Main', new HeaderField('SiteConfHeader', _t('Multisites.SITECONF', 'Site Configuration')), new TextField('Title', _t('Multisites.TITLE', 'Title')), new TextField('Tagline', _t('Multisites.TAGLINE', 'Tagline/Slogan')), $theme, new HeaderField('SiteURLHeader', _t('Multisites.SITEURL', 'Site URL')), new OptionsetField('Scheme', _t('Multisites.SCHEME', 'Scheme'), array('any' => _t('Multisites.ANY', 'Any'), 'http' => _t('Multisites.HTTP', 'HTTP'), 'https' => _t('Multisites.HTTPS', 'HTTPS (HTTP Secure)'))), new TextField('Host', _t('Multisites.HOST', 'Host')), new MultiValueTextField('HostAliases', _t('Multisites.HOSTALIASES', 'Host Aliases')), new CheckboxField('IsDefault', _t('Multisites.ISDEFAULT', 'Is this the default site?')), new HeaderField('SiteAdvancedHeader', _t('Multisites.SiteAdvancedHeader', 'Advanced Settings')), TextareaField::create('RobotsTxt', _t('Multisites.ROBOTSTXT', 'Robots.txt'))->setDescription(_t('Multisites.ROBOTSTXTUSAGE', '<p>Please consult <a href="http://www.robotstxt.org/robotstxt.html" target="_blank">http://www.robotstxt.org/robotstxt.html</a> for usage of the robots.txt file.</p>'))))); $devIDs = Config::inst()->get('Multisites', 'developer_identifiers'); if (is_array($devIDs)) { if (!ArrayLib::is_associative($devIDs)) { $devIDs = ArrayLib::valuekey($devIDs); } $fields->addFieldToTab('Root.Main', DropdownField::create('DevID', _t('Multisites.DeveloperIdentifier', 'Developer Identifier'), $devIDs)); } if (Multisites::inst()->assetsSubfolderPerSite()) { $fields->addFieldToTab('Root.Main', new TreeDropdownField('FolderID', _t('Multisites.ASSETSFOLDER', 'Assets Folder'), 'Folder'), 'SiteURLHeader'); } if (!Permission::check('SITE_EDIT_CONFIGURATION')) { foreach ($fields->dataFields() as $field) { $fields->makeFieldReadonly($field); } } $this->extend('updateSiteCMSFields', $fields); return $fields; }
public function getCMSFields() { $fields = FieldList::create(HeaderField::create('Outer Captions'), $category = DropdownField::create('FeaturedWorkCategoryID', 'Category', ProjectCategory::get()->map('ID', 'Title')), $imgUploadField = UploadField::create('ProjectCoverImage', 'Cover Image'), TextareaField::create('ProjectBriefDesc', 'Hover Over Description'), TextField::create('ProjectTitle', 'Title'), HeaderField::create('Project Phases'), $imgPhase1 = UploadField::create('ProjectPhaseImg1', 'Phase 1 Image'), TextareaField::create('ProjectPhaseDesc1', 'Phase 1 Description'), $imgPhase2 = UploadField::create('ProjectPhaseImg2', 'Phase 2 Image'), TextareaField::create('ProjectPhaseDesc2', 'Phase 2 Description'), $imgPhase3 = UploadField::create('ProjectPhaseImg3', 'Phase 3 Image'), TextareaField::create('ProjectPhaseDesc3', 'Phase 3 Description'), $imgPhase4 = UploadField::create('ProjectPhaseImg4', 'Phase 4 Image'), TextareaField::create('ProjectPhaseDesc4', 'Phase 4 Description'), $imgPhase5 = UploadField::create('ProjectPhaseImg5', 'Phase 5 Image'), TextareaField::create('ProjectPhaseDesc5', 'Phase 5 Description'), $imgPhase6 = UploadField::create('ProjectPhaseImg6', 'Phase 6 Image'), TextareaField::create('ProjectPhaseDesc6', 'Phase 6 Description')); //create inner GridField for ProjectPhases images /*$fields->addFieldToTab('Root.Phases', GridField::create( 'ProjectPhases', 'Project Phases', $this->ProjectPhases(), GridFieldConfig_RecordEditor::create() ));*/ //set image upload getTempFolder $imgUploadField->setFolderName('Featured Works Images'); //validate image upload types $imgUploadField->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 1 $imgPhase1->setFolderName('Project Phase Images'); $imgPhase1->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 2 $imgPhase2->setFolderName('Project Phase Images'); $imgPhase2->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 3 $imgPhase3->setFolderName('Project Phase Images'); $imgPhase3->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 4 $imgPhase4->setFolderName('Project Phase Images'); $imgPhase4->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 5 $imgPhase5->setFolderName('Project Phase Images'); $imgPhase5->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //project phase img 6 $imgPhase6->setFolderName('Project Phase Images'); $imgPhase6->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg')); //return the fields return $fields; }
/** * updateCMSFields. * Update Silverstripe CMS Fields for SEO Module * * @param FieldList * @return none */ public function updateCMSFields(FieldList $fields) { // exclude SEO tab from some pages if (in_array($this->owner->getClassName(), Config::inst()->get("SeoObjectExtension", "excluded_page_types"))) { return; } Requirements::css(SEO_DIR . '/css/seo.css'); Requirements::javascript(SEO_DIR . '/javascript/seo.js'); // better do this below in some init method? : $this->getSEOScoreCalculation(); $this->setSEOScoreTipsUL(); // lets create a new tab on top $fields->addFieldsToTab('Root.SEO', array(LiteralField::create('googlesearchsnippetintro', '<h3>' . _t('SEO.SEOGoogleSearchPreviewTitle', 'Preview google search') . '</h3>'), LiteralField::create('googlesearchsnippet', '<div id="google_search_snippet"></div>'), LiteralField::create('siteconfigtitle', '<div id="ss_siteconfig_title">' . $this->owner->getSiteConfig()->Title . '</div>'))); // move Metadata field from Root.Main to SEO tab for visualising direct impact on search result $fields->removeFieldFromTab('Root.Main', 'Metadata'); /*$fields->addFieldToTab("Root.SEO", new TabSet('Options', new Tab('Metadata', _t('SEO.SEOMetaData', 'Meta Data')), new Tab('HelpAndSEOScore', _t('SEO.SEOHelpAndScore', 'Help and SEO Score')) ));*/ $fields->addFieldsToTab('Root.SEO', array(TextareaField::create("MetaDescription", $this->owner->fieldLabel('MetaDescription'))->setRightTitle(_t('SiteTree.METADESCHELP', "Search engines use this content for displaying search results (although it will not influence their ranking)."))->addExtraClass('help'), TextareaField::create("ExtraMeta", $this->owner->fieldLabel('ExtraMeta'))->setRightTitle(_t('SiteTree.METAEXTRAHELP', "HTML tags for additional meta information. For example <meta name=\"customName\" content=\"your custom content here\" />"))->addExtraClass('help'))); $fields->addFieldsToTab('Root.SEO', array(GoogleSuggestField::create("SEOPageSubject", _t('SEO.SEOPageSubjectTitle', 'Subject of this page (required to view this page SEO score)')), LiteralField::create('', '<div class="message notice"><p>' . _t('SEO.SEOSaveNotice', "After making changes save this page to view the updated SEO score") . '</p></div>'), LiteralField::create('ScoreTitle', '<h4 class="seo_score">' . _t('SEO.SEOScore', 'SEO Score') . '</h4>'), LiteralField::create('Score', $this->getHTMLStars()), LiteralField::create('ScoreClear', '<div class="score_clear"></div>'))); if ($this->checkPageSubjectDefined()) { $fields->addFieldsToTab('Root.SEO', array(LiteralField::create('SimplePageSubjectCheckValues', $this->getHTMLSimplePageSubjectTest()))); } if ($this->seo_score < 12) { $fields->addFieldsToTab('Root.SEO', array(LiteralField::create('ScoreTipsTitle', '<h4 class="seo_score">' . _t('SEO.SEOScoreTips', 'SEO Score Tips') . '</h4>'), LiteralField::create('ScoreTips', $this->seo_score_tips))); } }
/** * A simple form for creating blog entries */ function FrontEndPostForm() { if ($this->owner->request->latestParam('ID')) { $id = (int) $this->owner->request->latestParam('ID'); } else { $id = 0; } $membername = Member::currentUser() ? Member::currentUser()->getName() : ""; // Set image upload $uploadfield = UploadField::create('FeaturedImage', _t('BlogFrontEnd.ShareImage', "Share an image")); $uploadfield->setCanAttachExisting(false); $uploadfield->setCanPreviewFolder(false); $uploadfield->setAllowedFileCategories('image'); $uploadfield->relationAutoSetting = false; if (BlogFrontEnd::config()->allow_wysiwyg_editing) { $content_field = TrumbowygHTMLEditorField::create("Content", _t("BlogFrontEnd.Content")); } else { $content_field = TextareaField::create("Content", _t("BlogFrontEnd.Content")); } $form = new Form($this->owner, 'FrontEndPostForm', $fields = new FieldList(HiddenField::create("ID", "ID"), TextField::create("Title", _t('BlogFrontEnd.Title', "Title")), $uploadfield, $content_field), $actions = new FieldList(FormAction::create('doSavePost', _t('BlogFrontEnd.PostEntry', 'Post Entry'))), new RequiredFields('Title')); $uploadfield->setForm($form); if ($this->owner->Categories()->exists()) { $fields->add(CheckboxsetField::create("Categories", _t("BlogFrontEnd.PostUnderCategories", "Post this in a category? (optional)"), $this->owner->Categories()->map())); } if ($this->owner->Tags()->exists()) { $fields->add(CheckboxsetField::create("Categories", _t("BlogFrontEnd.AddTags", "Add a tag? (optional)"), $this->owner->Tags()->map())); } if ($id && ($post = BlogPost::get()->byID($id))) { $form->loadDataFrom($post); } $this->owner->extend("updateFrontEndPostForm", $form); return $form; }
/** * Adds our SEO Meta fields to the page field list * * @since version 1.0.0 * * @param string $fields The current FieldList object * * @return object Return the FieldList object **/ public function updateCMSFields(FieldList $fields) { $fields->removeByName('HeadTags'); $fields->removeByName('SitemapImages'); if (!$this->owner instanceof Page) { $fields->addFieldToTab('Root.Page', HeaderField::create('Page')); $fields->addFieldToTab('Root.Page', TextField::create('Title', 'Page name')); } $fields->addFieldToTab('Root.PageSEO', $this->preview()); $fields->addFieldToTab('Root.PageSEO', TextField::create('MetaTitle')); $fields->addFieldToTab('Root.PageSEO', TextareaField::create('MetaDescription')); $fields->addFieldToTab('Root.PageSEO', HeaderField::create(false, 'Indexing', 2)); $fields->addFieldToTab('Root.PageSEO', TextField::create('Canonical')); $fields->addFieldToTab('Root.PageSEO', DropdownField::create('Robots', 'Robots', SEO_FieldValues::IndexRules())); $fields->addFieldToTab('Root.PageSEO', NumericField::create('Priority')); $fields->addFieldToTab('Root.PageSEO', DropdownField::create('ChangeFrequency', 'Change Frequency', SEO_FieldValues::SitemapChangeFrequency())); $fields->addFieldToTab('Root.PageSEO', CheckboxField::create('SitemapHide', 'Hide in sitemap? (XML and HTML)')); $fields->addFieldToTab('Root.PageSEO', HeaderField::create('Social Meta')); $fields->addFieldToTab('Root.PageSEO', CheckboxField::create('HideSocial', 'Hide Social Meta?')); $fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGtype', 'Open Graph Type', SEO_FieldValues::OGtype())); $fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGlocale', 'Open Graph Locale', SEO_FieldValues::OGlocale())); $fields->addFieldToTab('Root.PageSEO', DropdownField::create('TwitterCard', 'Twitter Card', SEO_FieldValues::TwitterCardTypes())); $fields->addFieldToTab('Root.PageSEO', $this->SharingImage()); $fields->addFieldToTab('Root.PageSEO', HeaderField::create('Other Meta Tags')); $fields->addFieldToTab('Root.PageSEO', $this->OtherHeadTags()); $fields->addFieldToTab('Root.PageSEO', HeaderField::create('Sitemap Images')); $fields->addFieldToTab('Root.PageSEO', $this->SitemapImagesGrid()); $fields->addFieldToTab('Root.PageSEO', LiteralField::create(false, '<br><br>Silverstripe SEO v1.0')); return $fields; }
public function updateCMSFields(FieldList $fields) { // vars $config = SiteConfig::current_site_config(); $owner = $this->owner; // decode data into array $data = json_decode($owner->OpenGraphData, true); // @todo Add repair method if data is missing / corrupt ~ for fringe cases // tab $tab = new Tab('OpenGraph'); // add disabled/error state if `off` if ($data['og:type'] === 'off') { $tab->addExtraClass('error'); } // add the tab $fields->addFieldToTab('Root.Metadata', $tab, 'FullOutput'); // new identity $tab = 'Root.Metadata.OpenGraph'; // add description // type always visible $fields->addFieldsToTab($tab, array(LabelField::create('OpenGraphHeader', '@todo Information</a>')->addExtraClass('information'), DropdownField::create('OpenGraphType', '<a href="http://ogp.me/#types">og:type</a>', self::$types, $data['og:type']))); if ($data['og:type'] !== 'off') { $fields->addFieldsToTab($tab, array(ReadonlyField::create('OpenGraphURL', 'Canonical URL', $owner->AbsoluteLink()), TextField::create('OpenGraphSiteName', 'Site Name', $data['og:site_name'])->setAttribute('placeholder', $config->Title), TextField::create('OpenGraphTitle', 'Page Title', $data['og:title'])->setAttribute('placeholder', $owner->Title), TextareaField::create('OpenGraphDescription', 'Description', $data['og:description'])->setAttribute('placeholder', $owner->GenerateDescription()), UploadField::create('OpenGraphImage', 'Image<pre>type: png/jpg/gif</pre><pre>size: variable *</pre>', $owner->OpenGraphImage)->setAllowedExtensions(array('png', 'jpg', 'jpeg', 'gif'))->setFolderName(self::$SEOOpenGraphUpload . $owner->Title)->setDescription('* <a href="https://developers.facebook.com/docs/sharing/best-practices#images" target="_blank">Facebook image best practices</a>, or use any preferred Open Graph guide.'))); } }
public function __construct($controller, $name, $fields = null, $actions = null) { $fields = new FieldList($Email = EmailField::create('Email')->setTitle(_t('ContactForm.EMAIL', 'ContactForm.EMAIL')), $Name = TextField::create('Name')->setTitle(_t('ContactForm.NAME', 'ContactForm.NAME')), $Message = TextareaField::create('Message')->setTitle(_t('ContactForm.MESSAGE', 'ContactForm.MESSAGE'))); $actions = new FieldList($Submit = FormAction::create('doContact')->setTitle(_t('ContactForm.BUTTONSEND', 'ContactForm.BUTTONSEND'))); $Submit->addExtraClass('btn'); parent::__construct($controller, $name, $fields, $actions, new RequiredFields("Email", "Name", "Message")); }
/** * CMS Fields * @var FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab("Root.Main", array(TextareaField::create('Title')->setRows(1), HTMLEditorField::create('Content'))); $this->extend('updateCMSFields', $fields); return $fields; }
public function getCMSFields() { $fields = FieldList::create(TextField::create('Title'), TextareaField::create('CaptionText'), $uploader = UploadField::create('Photo')); $uploader->setFolderName('home-slides'); $uploader->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg')); return $fields; }
function updateCMSFields(FieldList $fields) { $fields->removeByName("SummaryContent"); $fields->removeByName("SummaryImage"); $summary_fields = ToggleCompositeField::create('Summary', 'Summary Info.', array(TextareaField::create("SummaryContent", $this->owner->fieldLabel('SummaryContent')), UploadField::create("SummaryImage", $this->owner->fieldLabel('SummaryImage'))))->setHeadingLevel(4); $fields->addFieldToTab('Root.Main', $summary_fields, 'Metadata'); }
/** * CMS Fields * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab("Root.Main", array(TextareaField::create('Quote'), TextareaField::create('Citation')->setRows(1)->setDescription('Who cited/quoted this?'))); $this->extend('updateCMSFields', $fields); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->insertBefore(TextareaField::create('Intro', 'Intro'), 'Content'); $fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Intro"); $fields->insertBefore($image = UploadField::create('SplashImage', 'Splash Image'), 'Content'); $image->setFolderName('Uploads/Splash-Images'); if ($this->ClassName === "Page" || $this->ClassName === "HomePage") { $fields->insertAfter(HTMLEditorField::create('ExtraContent'), 'Content'); $gridField = new GridField('FeatureItems', 'FeatureItems', $this->FeatureItems()->sort(array('Sort' => 'ASC', 'Archived' => 'ASC')), $config = GridFieldConfig_RelationEditor::create()); $gridField->setModelClass('FeatureItem'); $fields->addFieldToTab('Root.Features', $gridField); $config->addComponent(new GridFieldOrderableRows()); } else { if ($this->ClassName === "CalendarPage") { $content = $fields->dataFieldByName('Content'); $content->addExtraClass('no-pagebreak'); $events = Event::get()->sort(array('StartDateTime' => 'Desc'))->filterByCallback(function ($record) { return !$record->getIsPastEvent(); }); $gridField = new GridField('Event', 'Upcoming Events', $events, $config = GridFieldConfig_RecordEditor::create()); $gridField->setModelClass('Event'); $dataColumns = $config->getComponentByType('GridFieldDataColumns'); $dataColumns->setDisplayFields(array('Title' => 'Title', 'StartDateTime' => 'Date and Time', 'DatesAndTimeframe' => 'Presentation String')); $fields->addFieldToTab('Root.UpcomingEvents', $gridField); } } return $fields; }
public function getUploadFields() { $fields = $this->owner->getCMSFields(); $fileAttributes = $fields->fieldByName('Root.Main.FilePreview')->fieldByName('FilePreviewData'); $fileAttributes->push(TextareaField::create('Caption', 'Caption:')->setRows(4)); $fields->removeFieldsFromTab('Root.Main', array('Title', 'Name', 'OwnerID', 'ParentID', 'Created', 'LastEdited', 'BackLinkCount', 'Dimensions')); return $fields; }
public function ApplicationForm() { $fields = FieldList::create(TextField::create('Name', 'Full name'), EmailField::create('Email', 'Email address'), PhoneNumberField::create('Phone', 'Contact Phone number'), DropdownField::create('JobID', 'Which job are you applying for?', $this->AvailableJobs()->map('ID', 'Title'))->setEmptyString('(Select)'), TextareaField::create('Application', 'Enter your experience and skills')); $actions = FieldList::create(FormAction::create('processApplication', 'Apply')); $validator = RequiredFields::create(array('Name', 'Email', 'Phone', 'JobID', 'Application')); $form = Form::create($this, 'ApplicationForm', $fields, $actions, $validator); return $form; }
public function getCMSFields() { $f = parent::getCMSFields(); $f->addFieldToTab('Root.Main', TextareaField::create('Map')->setTitle('Map')); $f->addFieldToTab('Root.Main', UploadField::create('Floorplan')->setTitle('Floorplan')->setFolderName('homes')); $f->addFieldToTab('Root.Gallery', new GridField('Images', 'Image', $this->Images(), GridFieldConfig_RelationEditor::create())); return $f; }
/** * Surface all configuration data to the admin area. * * @param \FieldList $fields */ public function updateCMSFields(\FieldList $fields) { if (!$this->owner->Backend()->config()->supports_environment_config) { return; } $backend = $this->owner->getEnvironmentConfigBackend(); $fields->addFieldsToTab('Root.Configuration', array(\TextareaField::create('Configuration', 'Configuration')->setValue($backend->getYaml())->setRows(30))); }
public function CommentForm() { $form = Form::create($this, __FUNCTION__, FieldList::create(TextField::create('Name', '')->setAttribute('placeholder', 'Name*')->addExtraClass('form-control'), EmailField::create('Email', '')->setAttribute('placeholder', 'Email*')->addExtraClass('form-control'), TextareaField::create('Comment', '')->setAttribute('placeholder', 'Comment*')->addExtraClass('form-control')), FieldList::create(FormAction::create('handleComment', 'Post Comment')->setUseButtonTag(true)->addExtraClass('btn btn-default-color btn-lg')), RequiredFields::create('Name', 'Email', 'Comment')); $form->addExtraClass('form-style'); $data = Session::get("FormData.{$form->getName()}.data"); //using the tirnary operator if $data exist... return $data ? $form->loadDataFrom($data) : $form; }