当前位置: 首页>>代码示例>>PHP>>正文


PHP FieldGroup::setName方法代码示例

本文整理汇总了PHP中FieldGroup::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldGroup::setName方法的具体用法?PHP FieldGroup::setName怎么用?PHP FieldGroup::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FieldGroup的用法示例。


在下文中一共展示了FieldGroup::setName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript('eventmanagement/javascript/event-ticket-cms.js');
     $fields->removeByName('EventID');
     $fields->removeByName('StartType');
     $fields->removeByName('StartDate');
     $fields->removeByName('StartDays');
     $fields->removeByName('StartHours');
     $fields->removeByName('StartMins');
     $fields->removeByName('EndType');
     $fields->removeByName('EndDate');
     $fields->removeByName('EndDays');
     $fields->removeByName('EndHours');
     $fields->removeByName('EndMins');
     if (class_exists('Payment')) {
         $fields->insertBefore(new OptionSetField('Type', 'Ticket type', array('Free' => 'Free ticket', 'Price' => 'Fixed price ticket')), 'Price');
     } else {
         $fields->removeByName('Type');
         $fields->removeByName('Price');
     }
     foreach (array('Start', 'End') as $type) {
         $fields->addFieldsToTab('Root.Main', array(new OptionSetField("{$type}Type", "{$type} sales at", array('Date' => 'A specific date and time', 'TimeBefore' => 'A time before the event starts')), $dateTime = new DatetimeField("{$type}Date", ''), $before = new FieldGroup("{$type}Offset", new NumericField("{$type}Days", 'Days'), new NumericField("{$type}Hours", 'Hours'), new NumericField("{$type}Mins", 'Minutes'))));
         $before->setName("{$type}Offset");
         $before->setTitle(' ');
         $dateTime->getDateField()->setConfig('showcalendar', true);
         $dateTime->getTimeField()->setConfig('showdropdown', true);
     }
     $fields->addFieldsToTab('Root.Advanced', array(new TextareaField('Description', 'Description'), new NumericField('MinTickets', 'Minimum tickets per order'), new NumericField('MaxTickets', 'Maximum tickets per order')));
     return $fields;
 }
开发者ID:tim-lar,项目名称:silverstripe-eventmanagement,代码行数:32,代码来源:EventTicket.php

示例2: getSettingsFields

 public function getSettingsFields()
 {
     $dataTypes = $this->getAvailableTypes();
     $reportable = $this->getReportableFields();
     $converted = array();
     foreach ($reportable as $k => $v) {
         $converted[$this->dottedFieldToUnique($k)] = $v;
     }
     $dataTypes = array_merge(array('' => ''), $dataTypes);
     $types = new MultiValueDropdownField('DataTypes', _t('AdvancedReport.DATA_TYPES', 'Data types'), $dataTypes);
     $fieldsGroup = new FieldGroup('Fields', $reportFieldsSelect = new MultiValueDropdownField('ReportFields', _t('AdvancedReport.REPORT_FIELDS', 'Report Fields'), $reportable));
     $fieldsGroup->push(new MultiValueTextField('ReportHeaders', _t('AdvancedReport.HEADERS', 'Header labels')));
     $fieldsGroup->addExtraClass('reportMultiField');
     $reportFieldsSelect->addExtraClass('reportFieldsSelection');
     $fieldsGroup->setName('FieldsGroup');
     $fieldsGroup->addExtraClass('advanced-report-fields dropdown');
     $conditions = new FieldGroup('Conditions', new MultiValueDropdownField('ConditionFields', _t('AdvancedReport.CONDITION_FIELDS', 'Condition Fields'), $reportable), new MultiValueDropdownField('ConditionOps', _t('AdvancedReport.CONDITION_OPERATIONS', 'Op'), $this->config()->allowed_conditions), new MultiValueTextField('ConditionValues', _t('AdvancedReport.CONDITION_VALUES', 'Value')));
     $conditions->setName('ConditionsGroup');
     $conditions->addExtraClass('dropdown');
     // define the group for the sort field
     $sortGroup = new FieldGroup('Sort', new MultiValueDropdownField('SortBy', _t('AdvancedReport.SORTED_BY', 'Sorted By'), $reportable), new MultiValueDropdownField('SortDir', _t('AdvancedReport.SORT_DIRECTION', 'Sort Direction'), array('ASC' => _t('AdvancedReport.ASC', 'Ascending'), 'DESC' => _t('AdvancedReport.DESC', 'Descending'))));
     $sortGroup->setName('SortGroup');
     $sortGroup->addExtraClass('dropdown');
     // build a list of the formatters
     $formatters = ClassInfo::implementorsOf('ReportFieldFormatter');
     $fmtrs = array();
     foreach ($formatters as $formatterClass) {
         $formatter = new $formatterClass();
         $fmtrs[$formatterClass] = $formatter->label();
     }
     // define the group for the custom field formatters
     $fieldFormattingGroup = new FieldGroup(_t('AdvancedReport.FORMAT_FIELDS', 'Custom field formatting'), new MultiValueDropdownField('FieldFormattingField', _t('AdvancedReport.FIELDFORMATTING', 'Field'), $converted), new MultiValueDropdownField('FieldFormattingFormatter', _t('AdvancedReport.FIELDFORMATTINGFORMATTER', 'Formatter'), $fmtrs));
     $fieldFormattingGroup->setName('FieldFormattingGroup');
     $fieldFormattingGroup->addExtraClass('dropdown');
     // assemble the fieldlist
     $fields = new FieldList(new TextField('Title', _t('AdvancedReport.TITLE', 'Title')), new TextareaField('Description', _t('AdvancedReport.DESCRIPTION', 'Description')), $types, $fieldsGroup, $conditions, new KeyValueField('ReportParams', _t('AdvancedReport.REPORT_PARAMETERS', 'Default report parameters')), $sortGroup, new MultiValueDropdownField('NumericSort', _t('AdvancedReport.SORT_NUMERICALLY', 'Sort these fields numerically'), $reportable), DropdownField::create('PaginateBy')->setTitle(_t('AdvancedReport.PAGINATE_BY', 'Paginate By'))->setSource($reportable)->setHasEmptyDefault(true), TextField::create('PageHeader')->setTitle(_t('AdvancedReport.HEADER_TEXT', 'Header text'))->setDescription(_t('AdvancedReport.USE_NAME_FOR_PAGE_NAME', 'use $name for the page name'))->setValue('$name'), new MultiValueDropdownField('AddInRows', _t('AdvancedReport.ADD_IN_ROWS', 'Add these columns for each row'), $converted), new MultiValueDropdownField('AddCols', _t('AdvancedReport.ADD_IN_ROWS', 'Provide totals for these columns'), $converted), $fieldFormattingGroup, new MultiValueDropdownField('ClearColumns', _t('AdvancedReport.CLEARED_COLS', '"Cleared" columns'), $converted));
     if ($this->config()->allow_grouping) {
         // GroupBy
         $groupingGroup = new FieldGroup('Grouping', new MultiValueDropdownField('GroupBy', _t('AdvancedReport.GROUPBY_FIELDS', 'Group by fields'), $reportable), new MultiValueDropdownField('SumFields', _t('AdvancedReport.SUM_FIELDS', 'SUM fields'), $reportable));
         $groupingGroup->addExtraClass('dropdown');
         $fields->insertAfter($groupingGroup, 'ConditionsGroup');
     }
     if ($this->hasMethod('updateReportFields')) {
         Deprecation::notice('3.0', 'The updateReportFields method is deprecated, instead overload getSettingsFields');
         $this->updateReportFields($fields);
     }
     $this->extend('updateSettingsFields', $fields);
     return $fields;
 }
开发者ID:nyeholt,项目名称:silverstripe-advancedreports,代码行数:49,代码来源:FreeformReport.php

示例3: getFieldsForFile

 /**
  * @return FieldList
  */
 protected function getFieldsForFile($relationListCount)
 {
     $extension = $this->getExtension();
     $previewField = new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' src='{$this->Icon($extension)}?r=" . rand(1, 100000) . "' alt='{$this->Title}' />\n");
     //count the number of pages this document is published on
     $publishedOnCount = $this->Pages()->Count();
     $publishedOnValue = "{$publishedOnCount} pages";
     if ($publishedOnCount == 1) {
         $publishedOnValue = "{$publishedOnCount} page";
     }
     $relationListCountValue = "{$relationListCount} pages";
     if ($relationListCount == 1) {
         $relationListCountValue = "{$relationListCount} page";
     }
     $fields = new FieldGroup($filePreview = CompositeField::create(CompositeField::create($previewField)->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("ID", "ID number" . ':', $this->ID), new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':', self::get_file_type($extension)), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'File size') . ':', $this->getFileSizeFormatted()), $urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank" class="file-url">%s</a>', $this->getLink(), $this->getLink())), new ReadonlyField("FilenameWithoutIDField", "Filename" . ':', $this->getFilenameWithoutID()), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded') . ':', $this->Created), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed') . ':', $this->LastEdited), new DateField_Disabled("LastChanged", _t('AssetTableField.LASTCHANGED', 'Last replaced') . ':', $this->LastChanged), new ReadonlyField("PublishedOn", "Published on" . ':', $publishedOnValue), new ReadonlyField("ReferencedOn", "Referenced on" . ':', $relationListCountValue)))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info'));
     $fields->setName('FileP');
     $urlField->dontEscape = true;
     return $fields;
 }
开发者ID:nyeholt,项目名称:silverstripe-dms,代码行数:22,代码来源:DMSDocument.php

示例4: setName

 public function setName($name)
 {
     parent::setName($name);
     foreach ($this->getChildren() as $child) {
         /** @var FormField $child */
         $thisName = $child->getName();
         $thisName = preg_replace('/^.*(\\[\\w+\\])$/', $name . '\\1', $thisName);
         $child->setName($thisName);
     }
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:10,代码来源:PhoneNumberField.php

示例5: getCreditCardFields

 /**
  * Create form fields to represent all of the properties on the {@link Omnipay\Common\CreditCard} object.
  * The form fields are split up into relevent sections to help with adding/removing fields as needed.
  *
  * @return FieldList
  */
 protected function getCreditCardFields()
 {
     $fields = new FieldList();
     $tabindex = 1;
     // Create personal detail fields
     $firstNameTextField = new TextField('FirstName', _t('OmnipayableForm.FIRSTNAME', 'First name'));
     $firstNameTextField->setAttribute('tabindex', $tabindex++);
     $lastNameTextField = new TextField('LastName', _t('OmnipayableForm.LASTNAME', 'Last name'));
     $lastNameTextField->setAttribute('tabindex', $tabindex++);
     $companyTextField = new TextField('Company', _t('OmnipayableForm.COMPANY', 'Company'));
     $companyTextField->setAttribute('tabindex', $tabindex++);
     $emailEmailField = new EmailField('Email', _t('OmnipayableForm.EMAIL', 'Email'));
     $emailEmailField->setAttribute('tabindex', $tabindex++);
     // Create personal details group
     $personalFieldGroup = new FieldGroup();
     $personalFieldGroup->setName('PersonalDetails');
     $personalFieldGroup->setTitle(_t('OmnipayableForm.PERSONALDETAILS', 'Personal Detials'));
     // Add basic fields to personal details group
     $personalFieldGroup->push($firstNameTextField);
     $personalFieldGroup->push($lastNameTextField);
     $personalFieldGroup->push($companyTextField);
     $personalFieldGroup->push($emailEmailField);
     // Add personal details group to fields
     $fields->push($personalFieldGroup);
     // Create credit card detail fields
     $numberCreditCardField = new CreditCardField('Number', _t('OmnipayableForm.NUMBER', 'Card number'));
     $numberCreditCardField->setAttribute('tabindex', $tabindex++);
     $cvvTextField = new TextField('Cvv', _t('OmnipayableForm.CVV', 'Security number'));
     $cvvTextField->setAttribute('tabindex', $tabindex += 3);
     $expiryMonthDropdownField = new DropdownField('ExpiryMonth', _t('OmnipayableForm.EXPIRYMONTH', 'Expiry month'), $this->getMonths());
     $expiryMonthDropdownField->setAttribute('tabindex', $tabindex++);
     $expiryMonthDropdownField->setHasEmptyDefault(true);
     $expiryYearDropdownField = new DropdownField('ExpiryYear', _t('OmnipayableForm.EXPIRYYEAR', 'Expiry year'), $this->getYears(20));
     $expiryYearDropdownField->setAttribute('tabindex', $tabindex++);
     $expiryYearDropdownField->setHasEmptyDefault(true);
     $startMonthDropdownField = new DropdownField('StartMonth', _t('OmnipayableForm.STARTMONTH', 'Start month'), $this->getMonths());
     $startMonthDropdownField->setAttribute('tabindex', $tabindex++);
     $startMonthDropdownField->setHasEmptyDefault(true);
     $startYearDropdownField = new DropdownField('StartYear', _t('OmnipayableForm.STARTYEAR', 'Start year'), $this->getYears(-20));
     $startYearDropdownField->setAttribute('tabindex', $tabindex++);
     $startYearDropdownField->setHasEmptyDefault(true);
     $issueNumberTextField = new TextField('IssueNumber', _t('OmnipayableForm.ISSUENUMBER', 'Issue number'));
     $issueNumberTextField->setAttribute('tabindex', $tabindex++);
     $typeDropdownField = new DropdownField('Type', _t('OmnipayableForm.TYPE', 'Card type'), $this->getCreditCardTypes());
     $typeDropdownField->setAttribute('tabindex', $tabindex++);
     $typeDropdownField->setHasEmptyDefault(true);
     $expiryDateFieldGroup = new FieldGroup();
     $expiryDateFieldGroup->push($expiryMonthDropdownField);
     $expiryDateFieldGroup->push($expiryYearDropdownField);
     $startDateFieldGroup = new FieldGroup();
     $startDateFieldGroup->push($startMonthDropdownField);
     $startDateFieldGroup->push($startYearDropdownField);
     // Create credit card details group
     $creditCardFieldGroup = new FieldGroup();
     $creditCardFieldGroup->setName('CardDetails');
     $creditCardFieldGroup->setTitle(_t('OmnipayableForm.CREDITCARDDETAILS', 'Card Detials'));
     // Add credit card fields to credit card details group
     $creditCardFieldGroup->push($numberCreditCardField);
     $creditCardFieldGroup->push($cvvTextField);
     $creditCardFieldGroup->push($expiryDateFieldGroup);
     $creditCardFieldGroup->push($startDateFieldGroup);
     $creditCardFieldGroup->push($issueNumberTextField);
     $creditCardFieldGroup->push($typeDropdownField);
     // Add credit card details group to fields
     $fields->push($creditCardFieldGroup);
     // Create billing address fields
     $billingAddress1TextField = new TextField('BillingAddress1', _t('OmnipayableForm.BILLINGADDRESS1', 'Address 1'));
     $billingAddress1TextField->setAttribute('tabindex', $tabindex++);
     $billingAddress2TextField = new TextField('BillingAddress2', _t('OmnipayableForm.BILLINGADDRESS2', 'Address 2'));
     $billingAddress2TextField->setAttribute('tabindex', $tabindex++);
     $billingCity = new TextField('BillingCity', _t('OmnipayableForm.BILLINGCITY', 'City'));
     $billingCity->setAttribute('tabindex', $tabindex++);
     $billingPostcode = new TextField('BillingPostcode', _t('OmnipayableForm.BILLINGPOSTCODE', 'Postcode'));
     $billingPostcode->setAttribute('tabindex', $tabindex++);
     $billingState = new TextField('BillingState', _t('OmnipayableForm.BILLINGSTATE', 'State'));
     $billingState->setAttribute('tabindex', $tabindex++);
     $billingCountry = new CountryDropdownField('BillingCountry', _t('OmnipayableForm.BILLINGCOUNTRY', 'Country'));
     $billingCountry->setAttribute('tabindex', $tabindex++);
     $billingPhone = new PhoneNumberField('BillingPhone', _t('OmnipayableForm.BILLINGPHONE', 'Phone'));
     $billingPhone->setAttribute('tabindex', $tabindex++);
     // Create billing details group
     $billingFieldGroup = new FieldGroup();
     $billingFieldGroup->setName('BillingAddress');
     $billingFieldGroup->setTitle(_t('OmnipayableForm.BILLING', 'Billing Address'));
     // Add billiing fields to billing group
     $billingFieldGroup->push($billingAddress1TextField);
     $billingFieldGroup->push($billingAddress2TextField);
     $billingFieldGroup->push($billingCity);
     $billingFieldGroup->push($billingPostcode);
     $billingFieldGroup->push($billingState);
     $billingFieldGroup->push($billingCountry);
     $billingFieldGroup->push($billingPhone);
     // Add billing details group to fields
     $fields->push($billingFieldGroup);
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-omnipayable,代码行数:101,代码来源:OmnipayableForm.php

示例6: assetsFolderField

 public static function assetsFolderField($obj, $dirExists)
 {
     $field = null;
     $msg = null;
     if ($dirExists) {
         //Message
         $defaultMsg = '<em>Files uploaded via the content area will be uploaded to</em>' . '<br /> <strong>' . Upload::config()->uploads_folder . '</strong>';
         if (method_exists($obj, 'getMessageUploadDirectory')) {
             $msg = $obj->getMessageUploadDirectory();
         }
         if (!$msg) {
             $msg = $defaultMsg;
         }
         //TODO these could also be global settings
         $manageAble = true;
         $editable = true;
         //As this is happening from the subsites administration, when editing a subsite
         //you'd probably be on another site, and hence can't access the site's files anyway
         if ($obj->ClassName == 'Subsite') {
             $manageAble = false;
             $editable = false;
         }
         if ($editable) {
             //Asset folder is editable
             $field1 = new TreeDropdownField('AssetsFolderID', 'Change Directory:', 'Folder');
             $field1->setRightTitle('Directory changes take place after saving.');
             //Dropdown field style adjustments
             //TODO move this to an external stylesheet as these styles don't kick in on AJAX loads
             Requirements::customCSS('
                 #Form_EditForm_UploadDirRulesNotes .ui-accordion-content {
                     overflow: visible;
                 }
                 #TreeDropdownField_Form_EditForm_AssetsFolderID {
                     min-width: 260px;
                 }
                 .UploadDirectoryFields .fieldgroup label {
                     padding: 0 0 4px;
                 }
             ');
             $dir = $obj->AssetsFolder();
             $filescount = File::get()->filter(array('ParentID' => $dir->ID))->count();
             $manageButton = null;
             if ($manageAble) {
                 $manageButton = "<a href='/admin/assets/show/" . $dir->ID . "' class='ss-ui-button ss-ui-button-small ui-button'>\n                        Manage Files (" . $filescount . ')</a>';
             }
             $field2 = new LiteralField('UploadDirRulesNote', "<div style='margin-bottom:10px;margin-right:16px;'>{$msg}</div>" . $manageButton);
             $field = new FieldGroup(array($field2, $field1));
             $field->setTitle('Upload Directory');
             $field->addExtraClass('UploadDirectoryFields');
             $field->setName('UploadDirectoryFields');
         } else {
             //Asset folder is not editable
             $field = new LiteralField('UploadDirRulesNote', '
                 <div class="field text" id="UploadDirRulesNote">
                     <label class="left">Upload Directory</label>
                     <div class="middleColumn">
                         <p style="margin-bottom: 0; padding-top: 0px;">
                             ' . $msg . '
                             <br />
                             <em>If you need to edit or change this folder, please contact your administrator.</em>
                         </p>
                     </div>
                 </div>
                 ');
         }
     } else {
         //Message
         $defaultMsg = 'Please <strong>choose a name and save</strong> for adding content.';
         if (method_exists($obj, 'getMessageSaveFirst')) {
             $msg = $obj->getMessageSaveFirst();
         }
         if (!$msg) {
             $msg = $defaultMsg;
         }
         //preview calculated assets folder
         //$msg = $msg . ' (' . $this->owner->getCalcAssetsFolderDirectory() . ')';
         $field = new LiteralField('UploadDirRulesNote', '
             <p class="message notice" >' . $msg . '</p>
         ');
     }
     return $field;
 }
开发者ID:titledk,项目名称:silverstripe-uploaddirrules,代码行数:82,代码来源:AssetsFolderCmsFieldsHelper.php


注:本文中的FieldGroup::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。