本文整理汇总了PHP中TextField::performReadonlyTransformation方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::performReadonlyTransformation方法的具体用法?PHP TextField::performReadonlyTransformation怎么用?PHP TextField::performReadonlyTransformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::performReadonlyTransformation方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performReadonlyTransformation
/**
* @return void
*/
public function performReadonlyTransformation()
{
parent::performReadonlyTransformation();
$readonly = new FieldList();
foreach ($this->manualFields as $field) {
$readonly->push($field->performReadonlyTransformation());
}
$this->manualFields = $readonly;
}
示例2: getCMSFields
public function getCMSFields()
{
$lid = new TextField('ListID', 'List ID');
$wid = new TextField('WebID', 'Web ID');
$name = new TextField('Name', 'List Name');
$sub = new TextField('Subscribed', '# of Subscribed Members');
$unsub = new TextField('Unsubscribed', '# of Un-Subscribed Members');
$clean = new TextField('Cleaned', '# of Cleaned Members');
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', $lid->performReadonlyTransformation());
$fields->addFieldToTab('Root.Main', $wid->performReadonlyTransformation());
$fields->addFieldToTab('Root.Main', $name->performReadonlyTransformation());
$fields->addFieldToTab('Root.Main', $sub->performReadonlyTransformation());
$fields->addFieldToTab('Root.Main', $unsub->performReadonlyTransformation());
$fields->addFieldToTab('Root.Main', $clean->performReadonlyTransformation());
$fields->removeByName("SortOrder");
$fields->removeByName("MCListFields");
$fields->removeByName("MCListSegments");
$fields->removeByName("MCSubscriptions");
/* START LIST SUBSCRIBERS GRIDFIELD */
$config = GridFieldConfig_RecordEditor::create();
$addComponent = $config->getComponentByType("GridFieldAddNewButton");
$addComponent->setButtonName("Add Subscriber");
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('FirstName' => 'First Name', 'Surname' => 'Surname', 'Email' => 'E-mail', 'Subscribed' => 'Active Subscription', 'Created' => 'Created', 'LastEdited' => 'LastEdited'));
$gf = new GridField('MCSubscribers', 'List Subscribers', $this->getComponents("MCSubscriptions", "", "\"MCListID\" ASC, \"Surname\" ASC, \"FirstName\" ASC, \"Email\" ASC"), $config);
$fields->addFieldToTab('Root.ListSubscribers', $gf);
/* FINISH LIST SUBSCRIBERS GRIDFIELD */
/* START MC LIST SEGMENTS GRIDFIELD */
$config = GridFieldConfig_RecordEditor::create();
$addComponent = $config->getComponentByType("GridFieldAddNewButton");
$config->removeComponent($addComponent);
$editComponent = $config->getComponentByType("GridFieldEditButton");
$config->removeComponent($editComponent);
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('getRelatedEventName' => 'Related Event Title', 'MCListSegmentID' => 'List Segment ID', 'Title' => 'List Segment Title'));
$gf = new GridField('MCListSegments', 'List Segments', $this->getComponents('MCListSegments'), $config);
$fields->addFieldToTab('Root.ListSegments', $gf);
/* FINISH MC LIST SEGMENTS GRIDFIELD */
/* START MC LIST FIELDS GRIDFIELD */
$config = GridFieldConfig_RecordEditor::create();
//$config->getComponentByType("GridFieldAddNewButton")->setButtonName("Add List Field Relationships");
// Should Only Be Able To Add Merge Tags Which Actually Exist In MailChimp. Therefore Do A List Sync Then Edit The Pulled In Merge Tags!
$addComponent = $config->getComponentByType("GridFieldAddNewButton");
$config->removeComponent($addComponent);
$deleteComponent = $config->getComponentByType("GridFieldDeleteAction");
$config->removeComponent($deleteComponent);
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('MergeTag' => 'MailChimp Merge Tag', 'FieldName' => 'Field Name', 'OnClass' => 'Class Name', 'SyncDirection' => 'Sync Direction'));
$gf = new GridField('MCListFields', 'MCListField', $this->getComponents('MCListFields'), $config);
$fields->addFieldToTab('Root.ListFieldMappings', $gf);
/* FINISH MC LIST FIELDS GRIDFIELD */
return $fields;
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$mergeTag = new TextField('MergeTag', 'Merge Tag');
$onClass = new DropdownField('OnClass', 'On Record', $this->AvailableClasses(), 'MCSubscription');
$fieldName = new GroupedDropdownField('FieldName', 'Field Name', $this->PopulateClassFieldNames());
$fields->removeByName("MCListID");
$fields->removeByName("MergeTag");
$fields->removeByName("OnClass");
$fields->removeByName("FieldName");
$fields->addFieldToTab('Root.Main', $mergeTag->performReadonlyTransformation(), 'SyncDirection');
$fields->addFieldToTab('Root.Main', $onClass, 'SyncDirection');
$fields->addFieldToTab('Root.Main', $fieldName, 'SyncDirection');
return $fields;
}
示例4: updateCMSFields
/**
* Adding fields for shop settings such as email, license key.
*
* @see DataObjectDecorator::updateCMSFields()
*/
function updateCMSFields(FieldSet &$fields)
{
$fields->findOrMakeTabSet('Root.Shop');
//License key
$fields->addFieldToTab("Root.Shop", new Tab('LicenseKey'));
$licenseKeyField = new TextField('LicenseKey', _t('ShopSettings.LICENSEKEY', 'License Key'), self::$license_key);
$fields->addFieldToTab('Root.Shop.LicenseKey', $licenseKeyField->performReadonlyTransformation());
//TODO include the license here in a text area field and some info about setting the license key perhaps
//Shop emails
$fields->addFieldToTab("Root.Shop", new TabSet('Emails'));
$fields->addFieldToTab("Root.Shop.Emails", new Tab('Receipt'), new Tab('Notification'));
$fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextField('ReceiptFrom', _t('ShopSettings.FROM', 'From')));
$receiptTo = new TextField('ReceiptTo', _t('ShopSettings.TO', 'To'));
$receiptTo->setValue(_t('ShopSettings.RECEIPT_TO', 'Sent to customer'));
$receiptTo = $receiptTo->performReadonlyTransformation();
$fields->addFieldToTab('Root.Shop.Emails.Receipt', $receiptTo);
$fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextField('ReceiptSubject', _t('ShopSettings.SUBJECT_LINE', 'Subject line')));
$fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextareaField('ReceiptBody', _t('ShopSettings.MESSAGE', 'Message (order details are included in the email)'), 8));
$fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextareaField('EmailSignature', _t('ShopSettings.SIGNATURE', 'Signature'), 8));
$notificationFrom = new TextField('NotificationFrom', _t('ShopSettings.FROM', 'From'));
$notificationFrom->setValue(_t('ShopSettings.NOTIFICATION_FROM', 'Customer email address'));
$notificationFrom = $notificationFrom->performReadonlyTransformation();
$fields->addFieldToTab('Root.Shop.Emails.Notification', $notificationFrom);
$fields->addFieldToTab('Root.Shop.Emails.Notification', new TextField('NotificationTo', _t('ShopSettings.TO', 'To')));
$fields->addFieldToTab('Root.Shop.Emails.Notification', new TextField('NotificationSubject', _t('ShopSettings.SUBJECT_LINE', 'Subject line')));
$fields->addFieldToTab('Root.Shop.Emails.Notification', new TextareaField('NotificationBody', _t('ShopSettings.MESSAGE', 'Message (order details are included in the email)'), 10));
//Shipping
$fields->findOrMakeTabSet('Root.Shop.Shipping');
$fields->addFieldToTab("Root.Shop.Shipping", new Tab('Countries'));
$fields->addFieldToTab("Root.Shop.Shipping", new Tab('Regions'));
$managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
$manager = new $managerClass($this->owner, 'ShippingCountries', 'Country_Shipping');
$fields->addFieldToTab("Root.Shop.Shipping.Countries", $manager);
$managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
$manager = new $managerClass($this->owner, 'ShippingRegions', 'Region_Shipping');
$fields->addFieldToTab("Root.Shop.Shipping.Regions", $manager);
if (file_exists(BASE_PATH . '/swipestripe') && ShopSettings::get_license_key() == null) {
$warning = _t('ShopSettings.LICENCE_WARNING', '
Warning: You have SwipeStripe installed without a license key.
Please <a href="http://swipestripe.com" target="_blank">purchase a license key here</a> before this site goes live.
');
$fields->addFieldToTab("Root.Main", new LiteralField("SwipeStripeLicenseWarning", '<p class="message warning">' . $warning . '</p>'), "Title");
}
}
示例5: updateCMSFields
/**
* @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;
}
示例6: TitleField
/**
* Title field of the field in the backend of the page
*
* @return TextField
*/
public function TitleField()
{
$label = _t('EditableFormField.ENTERQUESTION', 'Enter Question');
$field = new TextField('Title', $label, $this->getField('Title'));
$field->setName($this->getFieldName('Title'));
if (!$this->canEdit()) {
return $field->performReadonlyTransformation();
}
return $field;
}
示例7: TitleField
/**
* Title field of the field in the backend of the page
*
* @return TextField
*/
function TitleField()
{
//do not XML escape the title field here, because that would result in a recursive escaping of the escaped text on every save
$field = new TextField('Title', _t('EditableFormField.ENTERQUESTION', 'Enter Question'), $this->getField('Title'));
$field->setName($this->getFieldName('Title'));
if (!$this->canEdit()) {
return $field->performReadonlyTransformation();
}
return $field;
}
示例8: TitleField
/**
* Title field of the field in the backend of the page
*
* @return TextField
*/
function TitleField()
{
$field = new TextField('Title', _t('EditableFormField.ENTERQUESTION', 'Enter Question'), Convert::raw2att($this->Title));
$field->setName($this->getFieldName('Title'));
if (!$this->canEdit()) {
return $field->performReadonlyTransformation();
}
return $field;
}
示例9: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertBefore(new LiteralField('Title', "<h2>Order #{$this->ID} - " . $this->dbObject('Created')->Nice() . " - " . $this->Member()->getName() . "</h2>"), 'Root');
$fieldsAndTabsToBeRemoved = self::get_shipping_fields();
$fieldsAndTabsToBeRemoved[] = 'Printed';
$fieldsAndTabsToBeRemoved[] = 'MemberID';
$fieldsAndTabsToBeRemoved[] = 'Attributes';
$fieldsAndTabsToBeRemoved[] = 'SessionID';
foreach ($fieldsAndTabsToBeRemoved as $field) {
$fields->removeByName($field);
}
$htmlSummary = $this->renderWith("Order");
$printlabel = !$this->Printed ? "Print Invoice" : "Print Invoice Again";
//TODO: i18n
$fields->addFieldsToTab('Root.Main', array(new LiteralField("PrintInvoice", '<p class="print"><a href="OrderReport_Popup/index/' . $this->ID . '?print=1" onclick="javascript: window.open(this.href, \'print_order\', \'toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 50,top = 50\'); return false;">' . $printlabel . '</a></p>')));
$fields->addFieldToTab('Root.Main', new LiteralField('MainDetails', $htmlSummary));
//TODO: re-introduce this when order status logs have some meaningful purpose
$fields->removeByName('OrderStatusLogs');
$orderItemsTable = new TableListField("OrderItems", "OrderItem", OrderItem::$summary_fields, "\"OrderID\" = " . $this->ID, "\"Created\" ASC", null);
$orderItemsTable->setPermissions(array("view"));
$orderItemsTable->setPageSize(10000);
$orderItemsTable->addSummary("Total", array("Total" => array("sum", "Currency->Nice")));
$fields->addFieldToTab('Root.Items', $orderItemsTable);
$modifierTable = new TableListField("OrderModifiers", "OrderModifier", OrderModifier::$summary_fields, "\"OrderID\" = " . $this->ID . "", "\"Type\", \"Amount\" ASC, \"Created\" ASC", null);
$modifierTable->setPermissions(array("view"));
$modifierTable->setPageSize(10000);
$fields->addFieldToTab('Root.Extras', $modifierTable);
if ($m = $this->Member()) {
$lastv = new TextField("MemberLastLogin", "Last login", $m->dbObject('LastVisited')->Nice());
$fields->addFieldToTab('Root.Customer', $lastv->performReadonlyTransformation());
//TODO: this should be scaffolded instead, or come from something like $member->getCMSFields();
$fields->addFieldToTab('Root.Customer', new LiteralField("MemberSummary", $m->renderWith("Order_Member")));
}
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例10: performReadonlyTransformation
public function performReadonlyTransformation()
{
$newInst = parent::performReadonlyTransformation();
$newInst->helpText = $this->helpText;
$newInst->urlPrefix = $this->urlPrefix;
$newInst->urlSuffix = $this->urlSuffix;
$newInst->defaultUrl = $this->defaultUrl;
return $newInst;
}
示例11: getEcommerceFieldsForCMS
/**
* get CMS fields describing the member in the CMS when viewing the order.
*
* @return Field / ComponentSet
**/
public function getEcommerceFieldsForCMS()
{
$fields = new CompositeField();
$memberTitle = new TextField("MemberTitle", "Name", $this->owner->getTitle());
$fields->push($memberTitle->performReadonlyTransformation());
$memberEmail = new TextField("MemberEmail", "Email", $this->owner->Email);
$fields->push($memberEmail->performReadonlyTransformation());
$lastLogin = new TextField("MemberLastLogin", "Last login", $this->owner->dbObject('LastVisited')->Nice());
$fields->push($lastLogin->performReadonlyTransformation());
return $fields;
}