/** * @param bool $bool * * @return void */ public function setReadonly($bool) { parent::setReadonly($bool); foreach ($this->manualFields as $field) { $field->setReadonly($bool); } }
public function getCMSFields() { $fields = new FieldList(); $fields->add($name = new TextField('Name', 'Name')); $name->setReadonly(true); $fields->add(new TextField('Message', 'Custom Message')); return $fields; }
public function getCMSFields() { $fields = new FieldList(); $fields->add($type_txt = new TextField('Type', 'Type')); if ($this->ID > 0 && Summit::isDefaultEventType($this->Type)) { $type_txt->setReadonly(true); } $fields->add(new ColorField("Color", "Color")); $fields->add(new CheckboxField("BlackoutTimes", "Blackout Times")); $fields->add(new HiddenField('SummitID', 'SummitID')); return $fields; }
/** * Builds a new currency field based on the allowed currencies configured * * @return FormField */ protected function buildCurrencyField() { $name = $this->getName(); $allowedCurrencies = $this->getAllowedCurrencies(); if ($allowedCurrencies) { $field = new DropdownField("{$name}[Currency]", _t('MoneyField.FIELDLABELCURRENCY', 'Currency'), ArrayLib::is_associative($allowedCurrencies) ? $allowedCurrencies : array_combine($allowedCurrencies, $allowedCurrencies)); } else { $field = new TextField("{$name}[Currency]", _t('MoneyField.FIELDLABELCURRENCY', 'Currency')); } $field->setReadonly($this->isReadonly()); $field->setDisabled($this->isDisabled()); return $field; }
public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) { parent::loadDataFrom($data, $mergeStrategy, $fieldList); if ($data && $data instanceof SummitAttendee && $data->ID > 0) { // if we have an attendee then show the form on readonly mode ... $ticket = $data->Tickets()->first(); $this->fields->insertAfter($t1 = new TextField('TicketBoughtDate', 'Ticket Bought Date', $ticket->TicketBoughtDate), 'ExternalOrderId'); $t2 = $this->fields->fieldByName('ExternalOrderId'); $t2->setValue($ticket->ExternalOrderId); $this->fields->insertAfter($t3 = new TextField('TicketType', 'Ticket Type', $ticket->TicketType()->Name), 'TicketBoughtDate'); $t1->setReadonly(true); $t2->setReadonly(true); $t3->setReadonly(true); } }
public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) { parent::loadDataFrom($data, $mergeStrategy, $fieldList); if ($data && $data instanceof SummitAttendee && $data->ID > 0) { $this->fields->insertAfter($t1 = new TextField('TicketBoughtDate', 'Ticket Bought Date', $data->TicketBoughtDate), 'ExternalOrderId'); $t2 = $this->fields->fieldByName('ExternalOrderId'); $this->fields->insertAfter($t3 = new TextField('TicketType', 'Ticket Type', $data->TicketType()->Name), 'TicketBoughtDate'); $t1->setReadonly(true); $t2->setReadonly(true); $t3->setReadonly(true); $checkbox = $this->getField('SharedContactInfo'); if (!is_null($checkbox)) { $checkbox->setValue(intval($data->SharedContactInfo) === 1); } $btn = $this->Actions()->first(); if (!is_null($btn)) { $btn->setTitle('Save'); } } }
/** * @param FieldList $fields * @return FieldList|void */ public function updateCMSFields(FieldList $fields) { $oldFields = $fields->toArray(); foreach ($oldFields as $field) { $fields->remove($field); } $fields->push(new LiteralField("Title", "<h2>Marketplace Type</h2>")); $fields->push(new TextField("Name", "Name")); $fields->push(new CheckboxField("Active", "Active")); if ($this->owner->ID > 0) { $slug_field = new TextField('Slug', 'Slug'); $slug_field->setReadonly(true); $slug_field->setDisabled(true); $slug_field->performReadonlyTransformation(); $fields->push($slug_field); $group_field = new TextField('Group', 'Group', $this->owner->AdminGroup()->Title); $group_field->setReadonly(true); $group_field->setDisabled(true); $group_field->performReadonlyTransformation(); $fields->push($group_field); } return $fields; }
/** * Returns the quick access fields to display in GridField * * @return FieldList */ public function getQuickAccessFields() { $quickAccessFields = new FieldList(); $threeColField = '<div class="multi-col-field"><strong>%s</strong><span>%s</span><span>%s</span></div>'; $twoColField = '<div class="multi-col-field"><strong>%s</strong><span></span><span>%s</span></div>'; $orderNumberField = new TextField('OrderNumber__' . $this->ID, $this->fieldLabel('OrderNumber'), $this->OrderNumber); $orderStatusField = new TextField('SilvercartOrderStatus__' . $this->ID, $this->fieldLabel('SilvercartOrderStatus'), $this->SilvercartOrderStatus()->Title); $orderPositionTable = new SilvercartTableField('SilvercartOrderPositions__' . $this->ID, $this->fieldLabel('SilvercartOrderPositions'), $this->SilvercartOrderPositions()); $shippingField = new LiteralField('SilvercartShippingMethod__' . $this->ID, sprintf($threeColField, $this->fieldLabel('SilvercartShippingMethod'), $this->SilvercartShippingMethod()->TitleWithCarrier, $this->HandlingCostShipmentNice)); $paymentField = new LiteralField('SilvercartPaymentMethod__' . $this->ID, sprintf($threeColField, $this->fieldLabel('SilvercartPaymentMethod'), $this->SilvercartPaymentMethod()->Title, $this->HandlingCostPaymentNice)); $amountTotalField = new LiteralField('AmountTotal__' . $this->ID, sprintf($twoColField, $this->fieldLabel('AmountTotal'), $this->AmountTotalNice)); $orderNumberField->setReadonly(true); $orderStatusField->setReadonly(true); $mainGroup = new SilvercartFieldGroup('MainGroup'); $mainGroup->push($orderNumberField); $mainGroup->push($orderStatusField); $quickAccessFields->push($mainGroup); $quickAccessFields->push($orderPositionTable); $quickAccessFields->push($shippingField); $quickAccessFields->push($paymentField); $quickAccessFields->push($amountTotalField); $this->extend('updateQuickAccessFields', $quickAccessFields); return $quickAccessFields; }
public function setReadonly($readonly) { $this->setSliderOption('disabled', (bool) $readonly); return parent::setReadonly($readonly); }
/** * Adds a translation section * * @param FieldList $fields The FieldList * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 04.04.2013 */ public function updateCMSFields(FieldList $fields) { $this->getCMSFieldsIsCalled = true; $fields->findOrMakeTab('Root.SEO')->setTitle($this->owner->fieldLabel('SeoTab')); $fields->findOrMakeTab('Root.SocialMedia')->setTitle($this->owner->fieldLabel('SocialMediaTab')); $fields->findOrMakeTab('Root.Translations')->setTitle($this->owner->fieldLabel('TranslationsTab')); $googleWebmasterCodeField = new TextField('GoogleWebmasterCode', $this->owner->fieldLabel('GoogleWebmasterCode')); $googleAnalyticsTrackingCodeField = new TextareaField('GoogleAnalyticsTrackingCode', $this->owner->fieldLabel('GoogleAnalyticsTrackingCode')); $googleConversionTrackingCodeField = new TextareaField('GoogleConversionTrackingCode', $this->owner->fieldLabel('GoogleConversionTrackingCode')); $piwikTrackingCodeField = new TextareaField('PiwikTrackingCode', $this->owner->fieldLabel('PiwikTrackingCode')); $fields->addFieldToTab('Root.SEO', $googleWebmasterCodeField); $fields->addFieldToTab('Root.SEO', $googleAnalyticsTrackingCodeField); $fields->addFieldToTab('Root.SEO', $googleConversionTrackingCodeField); $fields->addFieldToTab('Root.SEO', $piwikTrackingCodeField); $facebookLinkField = new TextField('FacebookLink', $this->owner->fieldLabel('FacebookLink')); $twitterLinkField = new TextField('TwitterLink', $this->owner->fieldLabel('TwitterLink')); $xingLinkField = new TextField('XingLink', $this->owner->fieldLabel('XingLink')); $fields->addFieldToTab('Root.SocialMedia', $facebookLinkField); $fields->addFieldToTab('Root.SocialMedia', $twitterLinkField); $fields->addFieldToTab('Root.SocialMedia', $xingLinkField); $translatable = new Translatable(); $translatable->setOwner($this->owner); $translatable->updateCMSFields($fields); $localeField = new TextField('CurrentLocale', $this->owner->fieldLabel('CurrentLocale'), i18n::get_locale_name($this->owner->Locale)); $createButton = new InlineFormAction('createsitetreetranslation', $this->owner->fieldLabel('createsitetreetranslation')); $publishButton = new InlineFormAction('publishsitetree', $this->owner->fieldLabel('publishsitetree')); $localeField->setReadonly(true); $localeField->setDisabled(true); $createButton->setRightTitle($this->owner->fieldLabel('createsitetreetranslationDesc')); $createButton->includeDefaultJS(false); $createButton->addExtraClass('createTranslationButton'); $publishButton->includeDefaultJS(false); $publishButton->addExtraClass('createTranslationButton'); $fields->addFieldToTab('Root.Translations', $localeField, 'CreateTransHeader'); $fields->addFieldToTab('Root.Translations', $createButton, 'createtranslation'); $fields->addFieldToTab('Root.Translations', $publishButton, 'createtranslation'); $fields->removeByName('createtranslation'); $this->getCMSFieldsForSilvercart($fields); }