本文整理汇总了PHP中HeaderField类的典型用法代码示例。如果您正苦于以下问题:PHP HeaderField类的具体用法?PHP HeaderField怎么用?PHP HeaderField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HeaderField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormField
public function getFormField()
{
$labelField = new HeaderField($this->Name, $this->EscapedTitle, $this->Level);
$labelField->addExtraClass('FormHeading');
$labelField->setAttribute('data-id', $this->Name);
$this->doUpdateFormField($labelField);
return $labelField;
}
示例2: __construct
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);
}
示例3: getCMSFields
public function getCMSFields()
{
$DefaultAlbumCoverField = UploadField::create('DefaultAlbumCover');
$DefaultAlbumCoverField->folderName = "PhotoGallery";
$DefaultAlbumCoverField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
$fields = parent::getCMSFields();
$AlbumsGridField = new GridField("PhotoAlbums", "Album", $this->PhotoAlbums(), GridFieldConfig::create()->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldAddNewButton('toolbar-header-right'))->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldDataColumns())->addComponent(new GridFieldPaginator(50))->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldFilterHeader())->addComponent($sortable = new GridFieldSortableRows('SortID')));
if ($this->AlbumDefaultTop == true) {
$sortable->setAppendToTop(true);
}
$fields->addFieldToTab("Root.Albums", $AlbumsGridField);
$fields->addFieldToTab("Root.Config", HeaderField::create("Album Settings"));
$fields->addFieldToTab("Root.Config", $DefaultAlbumCoverField);
$fields->addFieldToTab("Root.Config", SliderField::create('AlbumsPerPage', 'Number of Albums Per Page', 1, 25));
$fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailWidth", "Album Cover Thumbnail Width", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailHeight", "Album Cover Thumbnail Height", 50, 400));
$fields->addFieldToTab("Root.Config", CheckboxField::create("ShowAllPhotoAlbums")->setTitle("Show photo album even if it's empty"));
$fields->addFieldToTab("Root.Config", CheckboxField::create("AlbumDefaultTop")->setTitle("Sort new albums to the top by default"));
$fields->addFieldToTab("Root.Config", HeaderField::create("Photo Settings"));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotosPerPage", "Number of Photos Per Page", 1, 50));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailWidth", "Photo Thumbnail Width", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailHeight", "Photo Thumbnail Height", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullWidth", "Photo Fullsize Width", 400, 1200));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullHeight", "Photo Fullsize Height", 400, 1200));
$fields->addFieldToTab("Root.Config", CheckboxField::create("PhotoDefaultTop")->setTitle("Sort new photos to the top by default"));
return $fields;
}
示例4: AddNewListboxForm
public function AddNewListboxForm()
{
$action = FormAction::create('doSave', 'Save')->setUseButtonTag('true');
if (!$this->isFrontend) {
$action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept');
}
$model = $this->getModel();
$link = singleton($model);
$fields = $link->getCMSFields();
$title = $this->getDialogTitle() ? $this->getDialogTitle() : 'New Item';
$fields->insertBefore(HeaderField::create('AddNewHeader', $title), $fields->first()->getName());
$actions = FieldList::create($action);
$form = Form::create($this, 'AddNewListboxForm', $fields, $actions);
$fields->push(HiddenField::create('model', 'model', $model));
/*
if($link){
$form->loadDataFrom($link);
$fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID));
}
// Chris Bolt, fixed this
//$this->owner->extend('updateLinkForm', $form);
$this->extend('updateLinkForm', $form);
// End Chris Bolt
*/
return $form;
}
示例5: LinkForm
/**
* The LinkForm for the dialog window
*
* @return Form
**/
public function LinkForm()
{
$link = $this->getLinkObject();
$action = FormAction::create('doSaveLink', _t('Linkable.SAVE', 'Save'))->setUseButtonTag('true');
if (!$this->isFrontend) {
$action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept');
}
$link = null;
if ($linkID = (int) $this->request->getVar('LinkID')) {
$link = Link::get()->byID($linkID);
}
$link = $link ? $link : singleton('Link');
$link->setAllowedTypes($this->getAllowedTypes());
$fields = $link->getCMSFields();
$title = $link ? _t('Linkable.EDITLINK', 'Edit Link') : _t('Linkable.ADDLINK', 'Add Link');
$fields->insertBefore(HeaderField::create('LinkHeader', $title), _t('Linkable.TITLE', 'Title'));
$actions = FieldList::create($action);
$form = Form::create($this, 'LinkForm', $fields, $actions);
if ($link) {
$form->loadDataFrom($link);
$fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID));
}
$this->owner->extend('updateLinkForm', $form);
return $form;
}
示例6: updateDynamicListCMSFields
public function updateDynamicListCMSFields($fields)
{
// Make sure the draft records are being looked at.
$stage = Versioned::current_stage();
Versioned::reading_stage('Stage');
$used = EditableFormField::get()->filter(array('ClassName:PartialMatch' => 'DynamicList'));
// Determine whether this dynamic list is being used anywhere.
$found = array();
foreach ($used as $field) {
// This information is stored using a serialised list, therefore we need to iterate through.
if ($field->getSetting('ListTitle') === $this->owner->Title) {
// Make sure there are no duplicates recorded.
if (!isset($found[$field->ParentID]) && ($form = UserDefinedForm::get()->byID($field->ParentID))) {
$found[$field->ParentID] = "<a href='{$form->CMSEditLink()}'>{$form->Title}</a>";
}
}
}
// Display whether there were any dynamic lists found on user defined forms.
if (count($found)) {
$fields->removeByName('UsedOnHeader');
$fields->addFieldToTab('Root.Main', HeaderField::create('UsedOnHeader', 'Used On', 5));
}
$display = count($found) ? implode('<br>', $found) : 'This dynamic list is <strong>not</strong> used.';
$fields->removeByName('UsedOn');
$fields->addFieldToTab('Root.Main', LiteralField::create('UsedOn', '<div>' . $display . '</div>'));
Versioned::reading_stage($stage);
}
示例7: updateSettingsFields
/**
* Display the vanity mapping fields.
*/
public function updateSettingsFields($fields)
{
$fields->addFieldToTab('Root.Misdirection', HeaderField::create('VanityHeader', 'Vanity'));
$fields->addFieldToTab('Root.Misdirection', TextField::create('VanityURL', 'URL', $this->owner->VanityMapping()->MappedLink)->setRightTitle('Mappings with higher priority will take precedence over this'));
// Allow extension customisation.
$this->owner->extend('updateSiteTreeMisdirectionExtensionSettingsFields', $fields);
}
开发者ID:helpfulrobot,项目名称:nglasl-silverstripe-misdirection,代码行数:10,代码来源:SiteTreeMisdirectionExtension.php
示例8: getCMSFields
public function getCMSFields($params = null)
{
//fields that shouldn't be changed once coupon is used
$fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
if (!$this->isInDB()) {
$fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
}
$this->extend("updateCMSFields", $fields, $params);
if ($count = $this->getUseCount()) {
$fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
}
if ($params && isset($params['forcetype'])) {
$valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
$fields->insertAfter($valuefield, "Type");
$fields->removeByName("Type");
} elseif ($this->Type && (double) $this->{$this->Type}) {
$valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
$fields->removeByName("Type");
$fields->insertAfter($valuefield, "ActionTitle");
$fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
if ($this->Type == "Percent") {
$fields->insertAfter($maxamountfield, "Percent");
}
}
return $fields;
}
示例9: getCMSFields
public function getCMSFields()
{
Requirements::css(BLOGGER_DIR . '/css/cms.css');
$self =& $this;
$this->beforeUpdateCMSFields(function ($fields) use($self) {
$fields->addFieldsToTab('Root.Main', array(HeaderField::create('Post Options', 3), $publishDate = DatetimeField::create("PublishDate", _t("BlogPost.PublishDate", "Publish Date")), ListboxField::create("Categories", _t("BlogPost.Categories", "Categories"), $self->Parent()->Categories()->map()->toArray())->setMultiple(true), ListboxField::create("Tags", _t("BlogPost.Tags", "Tags"), $self->Parent()->Tags()->map()->toArray())->setMultiple(true)));
$publishDate->getDateField()->setConfig("showcalendar", true);
// Add featured image
$fields->insertBefore($uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")), "Content");
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
});
$fields = parent::getCMSFields();
// We're going to make an SEO tab and move all the usual crap there
$menuTitle = $fields->dataFieldByName('MenuTitle');
$urlSegment = $fields->dataFieldByName('URLSegment');
$fields->addFieldsToTab('Root.SEO', array($menuTitle, $urlSegment));
$metaField = $fields->fieldByName('Root.Main.Metadata');
if ($metaField) {
$metaFields = $metaField->getChildren();
if ($metaFields->count() > 0) {
$tab = $fields->findOrMakeTab('Root.SEO');
$tab->push(HeaderField::create('Meta', 3));
foreach ($metaFields as $field) {
$tab->push($field);
}
}
$fields->removeByName('Metadata');
}
return $fields;
}
示例10: getCMSFields
/**
* 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($this->SystemName), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("This is the name your customers would see against this courier."), DropdownField::create("Enabled", "Enable this courier?", array("0" => "No", "1" => "Yes"))->setEmptyString("(Select one)")->setRightTitle("Can customers use this courier?")))));
return $fields;
}
示例11: __construct
public function __construct($controller, $name, Order $order)
{
$this->order = $order;
$fields = FieldList::create(HiddenField::create('OrderID', '', $order->ID));
$actions = FieldList::create();
//payment
if (self::config()->allow_paying && $order->canPay()) {
$gateways = GatewayInfo::get_supported_gateways();
//remove manual gateways
foreach ($gateways as $gateway => $gatewayname) {
if (GatewayInfo::is_manual($gateway)) {
unset($gateways[$gateway]);
}
}
if (!empty($gateways)) {
$fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MAKEPAYMENT", "Make Payment")));
$outstandingfield = Currency::create();
$outstandingfield->setValue($order->TotalOutstanding());
$fields->push(LiteralField::create("Outstanding", sprintf(_t("OrderActionsForm.OUTSTANDING", "Outstanding: %s"), $outstandingfield->Nice())));
$fields->push(OptionsetField::create('PaymentMethod', _t("OrderActionsForm.PAYMENTMETHOD", "Payment Method"), $gateways, key($gateways)));
$actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PAYORDER', 'Pay outstanding balance')));
}
}
//cancelling
if (self::config()->allow_cancelling && $order->canCancel()) {
$actions->push(FormAction::create('docancel', _t('OrderActionsForm.CANCELORDER', 'Cancel this order')));
}
parent::__construct($controller, $name, $fields, $actions);
$this->extend("updateForm", $order);
}
示例12: getCMSFields
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;
}
示例13: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// Use SortableUploadField instead of UploadField!
$imagesTab = $fields->findOrMakeTab('Root.Images');
$owner = $this->owner;
if ($owner::config()->allow_images) {
$limit = $owner::config()->images_count;
$uploadClass = class_exists("SortableUploadField") && $this->owner->Sorter == "SortOrder" ? "SortableUploadField" : "UploadField";
$imageField = $uploadClass::create('Images');
$imageField->setConfig('allowedMaxFileNumber', $limit);
$imageField->setFolderName('Uploads/' . $this->owner->ClassName . '/' . $this->owner->ID);
if ($limit == 1) {
$imagesTab->setTitle(_t("Object.IMAGETAB", "Images"));
$imageField->setTitle(_t("Object.IMAGEUPLOADLABEL", "Image"));
} else {
$imagesTab->setTitle(_t("Object.IMAGESTAB", "Images"));
$imageField->setTitle(_t("Object.IMAGESUPLOADLABEL", "Images"));
$imageField->setDescription(sprintf(_t("Object.IMAGESUPLOADLIMIT", "Images count limit: %s"), $limit));
if ($this->owner->Sorter == "SortOrder") {
$message = class_exists("SortableUploadField") ? _t("Object.IMAGESUPLOADHEADING", "<span style='color: green'>Sort images by draging thumbnail</span>") : _t("Object.IMAGESUPLOADHEADINGWRONG", "<span style='color: red'>Sorting images by draging thumbnails (SortOrder) not allowed. Missing module SortabeUploadField.</span>");
} else {
$message = _t("Object.IMAGESSORTERNOTICE", "Correct image sorting is visible on frontend only (if Sort by = Title, ID)");
}
$dropdownSorter = DropdownField::create('Sorter', _t("Object.IMAGESSORTER", "Sort images by: "))->setSource($this->owner->dbObject('Sorter')->enumValues());
$fields->addFieldToTab('Root.Images', $dropdownSorter);
$fields->addFieldToTab('Root.Images', HeaderField::create('ImagesNotice', $message)->setHeadingLevel(4));
}
$fields->addFieldToTab('Root.Images', $imageField);
} else {
$fields->removeByName($imagesTab->Name);
}
}
示例14: getCMSFields
/**
* 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 Tax Class"), CompositeField::create(TextField::create("Title", "Class Name")->setRightTitle("i.e. Zero Rate, Standard Rate.")))));
return $fields;
}
示例15: getCMSFields
/**
* 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 Tax Zone"), CompositeField::create(DropdownField::create("Enabled", "Enable this zone?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not disable the default tax zone." : "If enabled your store will use the rates defined in this zone for customers in the selected country.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false), !$this->exists() ? CountryDropdownField::create("Title", "Country")->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not select a country as this zone applies to all countries." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false) : "", $this->exists() ? GridField::create("TaxZones_TaxRates", "Tax Rates within the '" . $this->Title . "' Tax Zone", $this->TaxRates(), GridFieldConfig_RecordEditor::create()) : ""))));
return $fields;
}