public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab("Root.Main", array(TextField::create('Title', 'Color name')->setDescription('A name to identify this color'), HexColorField::create('HexCode', 'Hex code')->setDescription("Remember to include the '#'")->setAttribute('Placeholder', '#000000'), OptionsetField::create('Type', 'Color type')->setDescription('Where is this color allowed to be used')->setSource(array('Background' => 'Only for background colors', 'Text' => 'Only for text colors', 'Both' => 'For background and text colors'))));
     $fields->removeByName('FullCalendarID');
     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->merge(new FieldList(TextField::create("Title", _t("TagCloudWidget.TILE", "Title")), TextField::create("Limit", _t("TagCloudWidget.LIMIT", "Limit number of tags")), OptionsetField::create("SortParam"), OptionsetField::create("SortOrder")));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getFormFields(Order $order)
 {
     $fields = new FieldList();
     $estimates = $order->getShippingEstimates();
     $fields->push(OptionsetField::create("ShippingMethodID", _t('ShippingCheckoutComponent.ShippingOptions', 'Shipping Options'), $estimates->map(), $estimates->First()->ID));
     return $fields;
 }
 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);
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TabSet("Root", new Tab("Main", HeaderField::create("Application Settings", 3), TextField::create("FacebookConsumerKey", "Consumer Key"), PasswordField::create("FacebookConsumerSecret", "Consumer Secret"), OptionsetField::create("EnableFacebookLogin", "Facebook Login", array(0 => "Disabled", 1 => "Enabled")), OptionsetField::create("EnableFacebookSignup", "Facebook Signup", array(0 => "Disabled", 1 => "Enabled")))));
     $this->extend("updateCMSFields", $fields);
     return $fields;
 }
 public function __construct($controller, $name = "PostagePaymentForm")
 {
     // Get delivery data and postage areas from session
     $delivery_data = Session::get("Commerce.DeliveryDetailsForm.data");
     $country = $delivery_data['DeliveryCountry'];
     $postcode = $delivery_data['DeliveryPostCode'];
     $postage_areas = $controller->getPostageAreas($country, $postcode);
     // Loop through all postage areas and generate a new list
     $postage_array = array();
     foreach ($postage_areas as $area) {
         $area_currency = new Currency("Cost");
         $area_currency->setValue($area->Cost);
         $postage_array[$area->ID] = $area->Title . " (" . $area_currency->Nice() . ")";
     }
     $postage_id = Session::get('Commerce.PostageID') ? Session::get('Commerce.PostageID') : 0;
     // Setup postage fields
     $postage_field = CompositeField::create(HeaderField::create("PostageHeader", _t('Commerce.Postage', "Postage")), OptionsetField::create("PostageID", _t('Commerce.PostageSelection', 'Please select your prefered postage'), $postage_array)->setValue($postage_id))->setName("PostageFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
     // Get available payment methods and setup payment
     $payment_methods = SiteConfig::current_site_config()->PaymentMethods();
     // Deal with payment methods
     if ($payment_methods->exists()) {
         $payment_map = $payment_methods->map('ID', 'Label');
         $payment_value = $payment_methods->filter('Default', 1)->first()->ID;
     } else {
         $payment_map = array();
         $payment_value = 0;
     }
     $payment_field = CompositeField::create(HeaderField::create('PaymentHeading', _t('Commerce.Payment', 'Payment'), 2), OptionsetField::create('PaymentMethodID', _t('Commerce.PaymentSelection', 'Please choose how you would like to pay'), $payment_map, $payment_value))->setName("PaymentFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
     $fields = FieldList::create(CompositeField::create($postage_field, $payment_field)->setName("PostagePaymentFields")->addExtraClass("units-row")->addExtraClass("line"));
     $back_url = $controller->Link("billing");
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('doContinue', _t('Commerce.PaymentDetails', 'Enter Payment Details'))->addExtraClass('btn')->addExtraClass('commerce-action-next')->addExtraClass('btn-green'));
     $validator = RequiredFields::create(array("PostageID", "PaymentMethod"));
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 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 &amp; 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 &amp; 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->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;
 }
 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
 public function __construct($controller, $name, $fields = null, $actions = null)
 {
     $fields = new FieldList($Nickname = TextField::create('Nickname')->setTitle(_t('Member.NICKNAME', 'Member.NICKNAME'))->setValue(Session::get('FormInfo.GoogleSignupForm.Nickname')), $Type = OptionsetField::create('Type')->setTitle(_t('Member.TYPE', 'Member.TYPE'))->setSource(array("refugee" => _t('Member.TYPEREFUGEESIGNUP', 'Member.TYPEREFUGEESIGNUP'), "hostel" => _t('Member.TYPEHOSTELSIGNUP', 'Member.TYPEHOSTELSIGNUP'), "donator" => _t('Member.TYPEDONATORSIGNUP', 'Member.TYPEDONATORSIGNUP'))), $Location = BootstrapGeoLocationField::create('Location')->setTitle(_t('Member.LOCATION', 'Member.LOCATION')), LiteralField::create('Accept_TOS', _t('SignupForm.CONFIRMTOS', 'SignupForm.CONFIRMTOS')));
     $Type->setRightTitle(_t('Member.TYPEDESCRIPTION', 'Member.TYPEDESCRIPTION'));
     $Location->setRightTitle(_t('Member.LOCATIONDESCRIPTION', 'Member.LOCATIONDESCRIPTION'));
     $actions = new FieldList($Submit = BootstrapLoadingFormAction::create('doSignup')->setTitle(_t('SignupForm.BUTTONSIGNUP', 'SignupForm.BUTTONSIGNUP')));
     parent::__construct($controller, $name, $fields, $actions, new RequiredFields(array("Nickname", "Type", "Location")));
 }
 public function __construct($controller, $name, $fields = null, $actions = null)
 {
     $fields = new FieldList($Nickname = TextField::create('Nickname')->setTitle(_t('Member.NICKNAME', 'Member.NICKNAME')), $Type = OptionsetField::create('Type')->setTitle(_t('Member.TYPE', 'Member.TYPE'))->setSource(array("refugee" => _t('Member.TYPEREFUGEESIGNUP', 'Member.TYPEREFUGEESIGNUP'), "hostel" => _t('Member.TYPEHOSTELSIGNUP', 'Member.TYPEHOSTELSIGNUP'), "donator" => _t('Member.TYPEDONATORSIGNUP', 'Member.TYPEDONATORSIGNUP'))), $Location = BootstrapGeoLocationField::create('Location')->setTitle(_t('Member.LOCATION', 'Member.LOCATION')), $Email = EmailField::create('Email')->setTitle(_t('Member.EMAIL', 'Member.EMAIL')), PasswordField::create('Password')->setTitle(_t('Member.PASSWORD', 'Member.PASSWORD')), LiteralField::create('Accept_TOS', _t('SignupForm.CONFIRMTOS', 'SignupForm.CONFIRMTOS')));
     $Type->setRightTitle(_t('Member.TYPEDESCRIPTION', 'Member.TYPEDESCRIPTION'));
     $Location->setRightTitle(_t('Member.LOCATIONDESCRIPTION', 'Member.LOCATIONDESCRIPTION'));
     $actions = new FieldList($Submit = BootstrapLoadingFormAction::create('doSignup')->setTitle(_t('SignupForm.BUTTONSIGNUP', 'SignupForm.BUTTONSIGNUP')));
     parent::__construct($controller, $name, $fields, $actions, new RequiredUniqueFields($required = array("Nickname", "Type", "Location", "Email", "Password"), $unique = array("Email" => _t('SignupForm.EMAILEXISTS', 'SignupForm.EMAILEXISTS')), $objectClass = 'Member'));
 }
 public function getConfiguration()
 {
     $fields = parent::getConfiguration();
     $fields->push(TextField::create("Location", _t('Dashboard.LOCATION', 'Location')));
     // Added support for fetching by citycode if the city is not found.
     $fields->push(OptionsetField::create("LocationType", _t('Dashboard.TYPE', 'Location type'), array('city' => _t('Dashboard.CITY', 'City'), 'code' => _t('Dashboard.CODE', 'City code'))));
     $fields->push(DropdownField::create("Units", _t('Dashboard.UNITS', 'Units'), array('c' => _t('Dashboard.CELCIUS', 'Celcius'), 'f' => _t('Dashboard.FARENHEIT', 'Farenheit')))->addExtraClass("no-chzn"));
     return $fields;
 }
 public function getCMSFields()
 {
     $linksGridConfig = GridFieldConfig_RelationEditor::create();
     if ($this->Links()->Count() > 0) {
         $linksGridConfig->addComponent(new GridFieldOrderableRows());
     }
     $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), TextareaField::create('Content', 'Content'), UploadField::create('Image', 'Image')));
     return $fields;
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     /** =========================================
          * @var TextareaField $address
         ===========================================*/
     if (!$this->owner->TwitterCardType) {
         $this->owner->TwitterCardType = 'summary_large_image';
     }
     $fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Twitter Graph', 'Twitter Card', array(LiteralField::create('', '<h2>&nbsp;&nbsp;&nbsp;Twitter Card <img style="position:relative;top:4px;left 4px;" src="' . Director::absoluteBaseURL() . 'twitter-card-meta/images/twitter.png"></h2>'), 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'))));
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', TabSet::create('Settings'));
     }
     /** -----------------------------------------
      * Details
      * ----------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.SEO');
     $fields->addFieldsToTab('Root.Settings.SEO', array(HeaderField::create('', 'SEO Settings'), TextField::create('DefaultSEOMetaTitle', 'Default Meta Title Addition')->setRightTitle('This is additional copy that will be automatically added to all of your pages\' meta titles.'), OptionsetField::create('DefaultSEOMetaTitlePosition', 'Default Meta Title Position', array('before' => 'Prepend to the Meta Title', 'after' => 'Append to the Meta Title'))));
 }
 public function getFormField()
 {
     $field = OptionsetField::create($this->Name, $this->EscapedTitle, $this->getOptionsMap());
     $field->setFieldHolderTemplate('UserFormsMultipleOptionField_holder');
     // Set default item
     $defaultOption = $this->getDefaultOptions()->first();
     if ($defaultOption) {
         $field->setValue($defaultOption->EscapedTitle);
     }
     $this->doUpdateFormField($field);
     return $field;
 }
 public function getFormFields(Order $order)
 {
     $fields = FieldList::create();
     $gateways = GatewayInfo::getSupportedGateways();
     if (count($gateways) > 1) {
         $fields->push(OptionsetField::create('PaymentMethod', _t("CheckoutField.PaymentType", "Payment Type"), $gateways, array_keys($gateways)));
     }
     if (count($gateways) == 1) {
         $fields->push(HiddenField::create('PaymentMethod')->setValue(key($gateways)));
     }
     return $fields;
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     /** =========================================
          * @var FieldList $fields
          * @var TextField $title
          * @var OptionsetField $type
          * @var HtmlEditorField $content
          * @var CheckboxField $RemovePadding
          * @var CheckboxField $externalLink
          * @var UploadField $image
          * @var FieldGroup $linkSettings
          * @var GridFieldConfig_RelationEditor $config
         ===========================================*/
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addfieldToTab('Root.Main', $title = TextField::create('Title'));
     $title->setRightTitle('Title used in the cms as a visual cue for this piece of content.');
     $fields->addfieldToTab('Root.Main', $type = OptionsetField::create('Type', 'Type', $this->dbObject('Type')->enumValues()));
     $type->setRightTitle('Determines what fields are displayed in the CMS, and what content is displayed in the front-end.');
     $contentField = $content = HtmlEditorField::create('Content');
     $content->setRows(15);
     $fields->addfieldToTab('Root.Main', CheckboxField::create('RemovePadding', 'Remove padding from image'));
     $fields->addfieldToTab('Root.Main', CheckboxField::create('CoverImage', 'Make image a cover image'));
     $fields->addfieldToTab('Root.Main', TextField::create('MaxWidth', 'Max width of text fields')->setAttribute('placeholder', 'e.g. 768'));
     if ($this->Type == 'Content') {
         $fields->addfieldToTab('Root.Main', $contentField);
     }
     if ($this->Type == 'Image') {
         $fields->addfieldToTab('Root.Main', $image = UploadField::create('Image'));
         $image->setAllowedExtensions(array('jpeg', 'jpg', 'gif', 'png'));
         $image->setFolderName('Uploads/site-builder/items');
         $fields->addfieldToTab('Root.Main', HeaderField::create('', 'Link (optional)', 4));
         $fields->addfieldToTab('Root.Main', TreeDropdownField::create('InternalLinkID', 'Internal Link', 'SiteTree'));
         $fields->addfieldToTab('Root.Main', $externalLink = TextField::create('ExternalLink'));
         $externalLink->setAttribute('placeholder', 'http://');
         $externalLink->setRightTitle('Setting an external link will override the internal link.');
         $fields->addfieldToTab('Root.Main', $linkSettings = FieldGroup::create(array(CheckboxField::create('OpenLinkInNewTab', 'Open link in a new tab?'))));
         $linkSettings->setTitle('Settings');
         $fields->addfieldToTab('Root.Main', HeaderField::create('', 'Content (optional)', 4));
         $fields->addfieldToTab('Root.Main', $contentField);
     }
     if ($this->Type == 'Video') {
         $fields->addFieldToTab('Root.Main', TextareaField::create('YoutubeLink'));
         $fields->addFieldToTab('Root.Main', TextareaField::create('VimeoLink'));
     }
     if ($this->Type == 'Slider') {
         $config = GridFieldConfig_RelationEditor::create(10);
         $config->addComponent(GridFieldOrderableRows::create('SortOrder'))->addComponent(new GridFieldDeleteAction());
         $gridField = GridField::create('SliderItems', 'Items', $this->SliderItems(), $config);
         $fields->addFieldToTab('Root.Main', $gridField);
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('Sort');
     $fields->removeByName('Pages');
     $fields->removeByName('Active');
     $fields->removeByName('Header');
     // If this Block belongs to more than one page, show a warning
     $pcount = $this->Pages()->Count();
     if ($pcount > 1) {
         $globalwarningfield = new LiteralField("IsGlobalBlockWarning", '<p class="message warning">This block is in use on ' . $pcount . ' pages - any changes made will also affect the block on these pages</p>');
         $fields->addFieldToTab("Root.Main", $globalwarningfield, 'Name');
         $fields->addFieldToTab("Root.Images", $globalwarningfield, 'Images');
         $fields->addFieldToTab("Root.Template", $globalwarningfield);
         $fields->addFieldToTab("Root.Settings", $globalwarningfield);
     }
     $thumbField = new UploadField('Images', 'Images');
     $thumbField->allowedExtensions = array('jpg', 'gif', 'png');
     $fields->addFieldsToTab("Root.Main", new TextField('Name', 'Name'));
     $fields->addFieldsToTab("Root.Main", new DropdownField('Header', 'Use name as header', $this->dbObject('Header')->enumValues()), 'Content');
     $fields->addFieldsToTab("Root.Main", new HTMLEditorField('Content', 'Content'));
     // Image tab
     $fields->addFieldsToTab("Root.Images", $thumbField);
     // Template tab
     $optionset = array();
     $theme = SSViewer::current_theme();
     $src = BASE_PATH . "/themes/" . $theme . "/templates/BlockTemplates/";
     $imgsrc = "/themes/" . $theme . "/templates/BlockTemplates/";
     if (file_exists($src)) {
         foreach (glob($src . "*.ss") as $filename) {
             $name = $this->file_ext_strip(basename($filename));
             // Is there a template thumbnail
             $thumbnail = file_exists($src . $name . '.png') ? '<img src="' . $imgsrc . $name . '.png" />' : '<img src="' . $imgsrc . 'Blank.png" />';
             // TODO: Perhaps just add blank as alt for image, no need to check for existance?
             $html = '<div class="blockThumbnail">' . $thumbnail . '</div><strong class="title" title="Template file: ' . $filename . '">' . $name . '</strong>';
             $optionset[$name] = $html;
         }
         $tplField = OptionsetField::create("Template", "Choose a template", $optionset, $this->Template)->addExtraClass('stacked');
         $fields->addFieldsToTab("Root.Template", $tplField);
     } else {
         $fields->addFieldsToTab("Root.Template", new LiteralField($name = "literalfield", $content = '<p class="message warning"><strong>Warning:</strong> The folder ' . $src . ' was not found.</div>'));
     }
     // Settings tab
     $fields->addFieldsToTab("Root.Settings", new CheckboxField('Active', 'Active'));
     $fields->addFieldsToTab("Root.Settings", new TextField('Link', 'Link'));
     $PagesConfig = GridFieldConfig_RelationEditor::create(10);
     $PagesConfig->removeComponentsByType('GridFieldAddNewButton');
     $gridField = new GridField("Pages", "Related pages (This block is used on the following pages)", $this->Pages(), $PagesConfig);
     $fields->addFieldToTab("Root.Settings", $gridField);
     return $fields;
 }
 public function __construct($controller, $name, $type)
 {
     /* Fields */
     $fields = FieldList::create(OptionsetField::create("AddressID", "Choose an address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . Member::currentUserID() . ")")->map())->setEmptyString("(Select one)"), HiddenField::create("Type", "Type", $type));
     /* Actions */
     $actions = FieldList::create(CompositeField::create(FormAction::create('existingaddress', 'Use Address &amp; Continue')));
     /* Required Fields */
     $required = new RequiredFields(array("AddressID"));
     /*
      * Now we create the actual form with our fields and actions defined 
      * within this class.
      */
     return parent::__construct($controller, $name, $fields, $actions, $required);
 }
 /**
  *	Allow permission configuration for customisation of media.
  */
 public function updateCMSFields(FieldList $fields)
 {
     $permissions = array('ADMIN' => 'Administrators and developers', 'SITETREE_EDIT_ALL' => 'Content authors');
     Requirements::css(MEDIAWESOME_PATH . '/css/mediawesome.css');
     // Confirm that the current CMS user has permission.
     if (Permission::check('EDIT_SITECONFIG') === false) {
         $fields->addFieldToTab('Root.Access', $options = ReadonlyField::create('Media', 'Who can customise media?', $permissions[$this->owner->MediaPermission]));
     } else {
         // Display the permission configuration.
         $fields->addFieldToTab('Root.Access', $options = OptionsetField::create('MediaPermission', 'Who can customise media?', $permissions));
     }
     // Allow extension customisation.
     $this->owner->extend('updateSiteConfigMediaPermissionExtensionCMSFields', $fields);
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab("Root.Messages", array(TextField::create("HolderSubtitle", "Forum Holder Subtitle"), HTMLEditorField::create("HolderAbstract", "Forum Holder Abstract"), TextField::create("ProfileSubtitle", "Member Profile Subtitle"), HTMLEditorField::create("ProfileAbstract", "Member Profile Abstract"), TextField::create("ForumSubtitle", "Create topic Subtitle"), HTMLEditorField::create("ForumAbstract", "Create topic Abstract"), HTMLEditorField::create("ProfileModify", "Create message after modifing forum member"), HTMLEditorField::create("ProfileAdd", "Create message after adding forum member")));
     $fields->addFieldsToTab("Root.Settings", array(CheckboxField::create("DisplaySignatures", "Display Member Signatures?"), CheckboxField::create("ShowInCategories", "Show Forums In Categories?"), CheckboxField::create("AllowGravatars", "Allow <a href='http://www.gravatar.com/' target='_blank'>Gravatars</a>?"), DropdownField::create("GravatarType", "Gravatar Type", array("standard" => _t('Forum.STANDARD', 'Standard'), "identicon" => _t('Forum.IDENTICON', 'Identicon'), "wavatar" => _t('Forum.WAVATAR', 'Wavatar'), "monsterid" => _t('Forum.MONSTERID', 'Monsterid'), "retro" => _t('Forum.RETRO', 'Retro'), "mm" => _t('Forum.MM', 'Mystery Man')))->setEmptyString('Use Forum Default')));
     // add a grid field to the category tab with all the categories
     $categoryConfig = GridFieldConfig::create()->addComponents(new GridFieldSortableHeader(), new GridFieldButtonRow(), new GridFieldDataColumns(), new GridFieldEditButton(), new GridFieldViewButton(), new GridFieldDeleteAction(), new GridFieldAddNewButton('buttons-before-left'), new GridFieldPaginator(), new GridFieldDetailForm());
     $categories = GridField::create('Category', _t('Forum.FORUMCATEGORY', 'Forum Category'), $this->Categories(), $categoryConfig);
     $fields->addFieldsToTab("Root.Categories", $categories);
     $fields->addFieldsToTab("Root.LanguageFilter", array(TextField::create("ForbiddenWords", "Forbidden words (comma separated)"), LiteralField::create("FWLabel", "These words will be replaced by an asterisk")));
     $fields->addFieldToTab("Root.Access", HeaderField::create(_t('Forum.ACCESSPOST', 'Who can post to the forum?'), 2));
     $fields->addFieldToTab("Root.Access", OptionsetField::create("CanPostType", "", array("Anyone" => _t('Forum.READANYONE', 'Anyone'), "LoggedInUsers" => _t('Forum.READLOGGEDIN', 'Logged-in users'), "NoOne" => _t('Forum.READNOONE', 'Nobody. Make Forum Read Only'))));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->ID) {
         // Payment Gateway Options
         $email_options = array("Don't", 'Send to customer and vendor', 'Send only to vendor');
         $fields->addFieldToTab("Root.Main", TextField::create('VendorName', 'Vendor name'), "Summary");
         $fields->addFieldToTab("Root.Main", DropdownField::create('ProtocolVersion', 'Version of forms protocol to use?', singleton('SagePay')->dbObject('ProtocolVersion')->enumValues()), "Summary");
         $fields->addFieldToTab('Root.Main', PasswordField::create('EncryptedPassword', 'Password'), "Summary");
         $fields->addFieldToTab("Root.Main", OptionsetField::create('SendEmail', 'How would you like SagePay to send emails?', $email_options), "Summary");
         $fields->addFieldToTab("Root.Main", EmailField::create('EmailRecipient', 'Email address of user to recieve email'), "Summary");
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root.Main", new TextField("textfield", "Text field"), 'Metadata');
     $fields->addFieldToTab("Root.Main", new TextAreaField("textarea", "Textarea"), 'Metadata');
     $fields->addFieldToTab('Root.Main', new CheckboxField('ShowInSearch', 'Show in search?'), 'Metadata');
     $fields->addFieldToTab('Root.Main', OptionsetField::create('Icon', 'Icon', array(1 => 'option 1', 2 => 'option 2')), 'Metadata');
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('Description', 'Description'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new HiddenField('Referrer', 'Referrer', 'listview'), 'Metadata');
     $fields->addFieldToTab('Root.Main', new DateField('datefoeld'), 'Metadata');
     $fields->addFieldToTab('Root.Main', EmailField::create('Email', 'Email'), 'Metadata');
     $fields->addFieldToTab('Root.Main', PhoneNumberField::create('Phone', 'Phone'), 'Metadata');
     return $fields;
 }
 function ShippingMethodForm()
 {
     $order = $this->owner->Cart();
     $estimates = $order->getShippingEstimates();
     $fields = new FieldList();
     if ($estimates->exists()) {
         $fields->push(OptionsetField::create("ShippingMethodID", _t('CheckoutStep_ShippingMethod.ShippingOptions', 'Shipping Options'), $estimates->map(), $estimates->First()->ID));
     } else {
         $fields->push(LiteralField::create("NoShippingMethods", _t('CheckoutStep_ShippingMethod.NoShippingMethods', '<p class=\\"message warning\\">There are no shipping methods available</p>')));
     }
     $actions = new FieldList(new FormAction("setShippingMethod", "Continue"));
     $form = new Form($this->owner, "ShippingMethodForm", $fields, $actions);
     $this->owner->extend('updateShippingMethodForm', $form);
     return $form;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Locations Grid Field
     $config = GridFieldConfig_RecordEditor::create();
     $locations = Location::get();
     $fields->addFieldToTab('Root.Locations', GridField::create('Locations', 'Locations', $locations, $config));
     // Location categories
     $config = GridFieldConfig_RecordEditor::create();
     $fields->addFieldToTab('Root.Categories', GridField::create('Categories', 'Categories', LocationCategory::get(), $config));
     // Settings
     $fields->addFieldsToTab('Root.Settings', array(HeaderField::create('DisplayOptions', 'Display Options', 3), OptionsetField::create('Unit', 'Unit of measure', array('m' => 'Miles', 'km' => 'Kilometers')), CheckboxField::create('AutoGeocode', 'Auto Geocode - Automatically filter map results based on user location')->setDescription('Note: if any locations are set as featured, the auto geocode is automatically disabled.'), CheckboxField::create('ModalWindow', 'Modal Window - Show Map results in a modal window')));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function __construct($controller, $name, $order_id)
 {
     $Order = new Order();
     /* Fields */
     $fields = FieldList::create(OptionsetField::create("Courier", "Courier", $Order->getCouriers($order_id, true)));
     /* Actions */
     $actions = FieldList::create(FormAction::create('selectcourier', 'Select Courier &amp; Proceed To Order Summary'));
     /* Required Fields */
     $required = new RequiredFields(array("Courier"));
     /*
      * 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 updateCMSFields(FieldList $fields)
 {
     // Changed Type to an optionset because drop down does not work sometimes in a dialog :-(
     // Also move sitetree to first item, I like that better.
     $types = $this->owner->config()->get('types');
     $i18nTypes = array();
     // Move SiteTree to first
     $i18nTypes['SiteTree'] = _t('Linkable.TYPE' . strtoupper('SiteTree'), $types['SiteTree']);
     foreach ($types as $key => $label) {
         $i18nTypes[$key] = _t('Linkable.TYPE' . strtoupper($key), $label);
     }
     $fields->replaceField('Type', OptionsetField::create('Type', _t('Linkable.LINKTYPE', 'Link Type'), $i18nTypes), 'OpenInNewWindow');
     // Chris Bolt, replaced file choose with an upload field
     $fields->replaceField('FileID', UploadField::create('File', _t('Linkable.FILE', 'File')), 'OpenInNewWindow');
     // Chris Bolt, added functionality for adding custom attributes
     $fields->addFieldToTab('Root.Main', TextField::create('ExtraAttributes', 'Extra Attributes')->setDescription('e.g. onClick="_gaq.push([\'_trackEvent\', \'whitepaper\', \'download\', pdfName, pdfValue, true]);"'));
 }
 public function __construct($controller, $name, $poll)
 {
     if (!$poll) {
         user_error("The poll doesn't exist.", E_USER_ERROR);
     }
     $this->poll = $poll;
     $data = $poll->Answers()->map('ID', 'Title');
     if ($poll->Multiple) {
         $choiceField = CheckboxSetField::create('PollChoices', $poll->Question, $data);
     } else {
         $choiceField = OptionsetField::create('PollChoices', '', $data);
     }
     $fields = FieldList::create($choiceField);
     $actions = FieldList::create(FormAction::create('submitPoll', 'Verstuur'));
     $validator = RequiredFields::create(array('PollChoices'));
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }