本文整理匯總了PHP中FieldSet::findOrMakeTabSet方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::findOrMakeTabSet方法的具體用法?PHP FieldSet::findOrMakeTabSet怎麽用?PHP FieldSet::findOrMakeTabSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FieldSet
的用法示例。
在下文中一共展示了FieldSet::findOrMakeTabSet方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateCMSFields
/**
* Create {@link ComplexTableField} for managing {@link FlatFeeShippingRate}s.
*
* @see DataObjectDecorator::updateCMSFields()
*/
function updateCMSFields(FieldSet &$fields)
{
$fields->findOrMakeTabSet('Root.Shop.Shipping');
$fields->addFieldToTab("Root.Shop.Shipping", new Tab('FlatFeeShipping'));
$managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
$flatFeeManager = new $managerClass($this->owner, 'FlatFeeShippingRates', 'FlatFeeShippingRate', array('Title' => 'Label', 'Description' => 'Description', 'Country.Title' => 'Country', 'SummaryOfAmount' => 'Amount'), 'getCMSFields_forPopup');
$fields->addFieldToTab("Root.Shop.Shipping.FlatFeeShipping", $flatFeeManager);
}
示例2: 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");
}
}