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


PHP FieldGroup::addExtraClass方法代码示例

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


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

示例1: getCMSFields

 /**
  * Overwrites SiteTree.getCMSFields.
  *
  * This method creates a customised CMS form for back-end user.
  *
  * @return fieldset
  */
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $csv_file = $fields->fieldByName("Root.Main.CSVFile");
     $pdf_file = $fields->fieldByName("Root.Main.PDFFile");
     $html_file = $fields->fieldByName("Root.Main.HTMLFile");
     //Remove all fields - then add nicely...
     $fields->removeFieldsFromTab("Root.Main", array("ReportFields", "ReportHeaders", "ConditionFields", "ConditionOps", "ConditionValues", "PaginateBy", "PageHeader", "SortBy", "SortDir", "ClearColumns", "AddInRows", "AddCols", "CSVFile", "PDFFile", "HTMLFile", "ReportID"));
     $reportFields = $this->getReportableFields();
     $fieldsGroup = new FieldGroup('Fields', new MultiValueDropdownField('ReportFields', _t('AdvancedReport.REPORT_FIELDS', 'Report Fields'), $reportFields), new MultiValueTextField('ReportHeaders', _t('AdvancedReport.REPORT_HEADERS', 'Headers')));
     $fieldsGroup->addExtraClass('reportMultiField');
     $conditions = new FieldGroup('Conditions', new MultiValueDropdownField('ConditionFields', _t('AdvancedReport.CONDITION_FIELDS', 'Condition Fields'), $reportFields), new MultiValueDropdownField('ConditionOps', _t('AdvancedReport.CONDITION_OPERATIONS', 'Op'), self::$allowed_conditions), new MultiValueTextField('ConditionValues', _t('AdvancedReport.CONDITION_VALUES', 'Value')));
     $conditions->addExtraClass('reportMultiField');
     $combofield = new FieldGroup('Sorting', new MultiValueDropdownField('SortBy', _t('AdvancedReport.SORTED_BY', 'Sorted By'), $reportFields), new MultiValueDropdownField('SortDir', _t('AdvancedReport.SORT_DIRECTION', 'Sort Direction'), array('ASC' => _t('AdvancedReport.ASC', 'Ascending'), 'DESC' => _t('AdvancedReport.DESC', 'Descending'))));
     $combofield->addExtraClass('reportMultiField');
     $paginateFields = $reportFields;
     array_unshift($paginateFields, '');
     $fields->addFieldsToTab("Root.Main", array($fieldsGroup, $conditions, $combofield, new FieldGroup('Formatting', new DropdownField('PaginateBy', _t('AdvancedReport.PAGINATE_BY', 'Paginate By'), $paginateFields), new TextField('PageHeader', _t('AdvancedReport.PAGED_HEADER', 'Header text (use $name for the page name)'), '$name'), new MultiValueDropdownField('AddInRows', _t('AdvancedReport.ADD_IN_ROWS', 'Add these columns for each row'), $reportFields), new MultiValueDropdownField('AddCols', _t('AdvancedReport.ADD_IN_ROWS', 'Provide totals for these columns'), $reportFields), new MultiValueDropdownField('ClearColumns', _t('AdvancedReport.CLEARED_COLS', '"Cleared" columns'), $reportFields))));
     /* create a dedicated tab for report download files
      * @todo convert to InlineFormAction or the like to allow user to download report files
      * @todo provide a Generate Link Action on this page
      */
     $fields->addFieldsToTab("Root.Reports", array(new FieldGroup("Files", $csv_file, $pdf_file, $html_file)));
     return $fields;
 }
开发者ID:rodneyway,项目名称:silverstripe-advancedreports,代码行数:32,代码来源:AdvancedReport.php

示例2: getCMSFields

 public function getCMSFields()
 {
     $self = $this;
     $this->beforeUpdateCMSFields(function ($f) use($self) {
         Requirements::javascript('event_calendar/javascript/calendar_cms.js');
         $f->addFieldToTab("Root.Main", TextField::create("Location", _t('Calendar.LOCATIONDESCRIPTION', 'The location for this event')), 'Content');
         $dt = _t('CalendarEvent.DATESANDTIMES', 'Dates and Times');
         $recursion = _t('CalendarEvent.RECURSION', 'Recursion');
         $f->addFieldToTab("Root.{$dt}", GridField::create("DateTimes", _t('Calendar.DATETIMEDESCRIPTION', 'Add dates for this event'), $self->DateTimes(), GridFieldConfig_RecordEditor::create()));
         $f->addFieldsToTab("Root.{$recursion}", array(new CheckboxField('Recursion', _t('CalendarEvent.REPEATEVENT', 'Repeat this event')), new OptionsetField('CustomRecursionType', _t('CalendarEvent.DESCRIBEINTERVAL', 'Describe the interval at which this event recurs.'), array('1' => _t('CalendarEvent.DAILY', 'Daily'), '2' => _t('CalendarEvent.WEEKLY', 'Weekly'), '3' => _t('CalendarEvent.MONTHLY', 'Monthly')))));
         $f->addFieldToTab("Root.{$recursion}", $dailyInterval = new FieldGroup(new LabelField($name = "every1", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('DailyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "days", $title = _t("CalendarEvent.DAYS", " day(s)"))));
         $f->addFieldToTab("Root.{$recursion}", $weeklyInterval = new FieldGroup(new LabelField($name = "every2", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('WeeklyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "weeks", $title = _t("CalendarEvent.WEEKS", " weeks"))));
         $f->addFieldToTab("Root.{$recursion}", new CheckboxSetField('RecurringDaysOfWeek', _t('CalendarEvent.ONFOLLOWINGDAYS', 'On the following day(s)...'), DataList::create("RecurringDayOfWeek")->map("ID", "Title")));
         $f->addFieldToTab("Root.{$recursion}", $monthlyInterval = new FieldGroup(new LabelField($name = "every3", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('MonthlyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "months", $title = _t("CalendarEvent.MONTHS", " month(s)"))));
         $f->addFieldsToTab("Root.{$recursion}", array(new OptionsetField('MonthlyRecursionType1', '', array('1' => _t('CalendarEvent.ONTHESEDATES', 'On these date(s)...'))), new CheckboxSetField('RecurringDaysOfMonth', '', DataList::create("RecurringDayOfMonth")->map("ID", "Value")), new OptionsetField('MonthlyRecursionType2', '', array('1' => _t('CalendarEvent.ONTHE', 'On the...')))));
         $f->addFieldToTab("Root.{$recursion}", $monthlyIndex = new FieldGroup(new DropdownField('MonthlyIndex', '', array('1' => _t('CalendarEvent.FIRST', 'First'), '2' => _t('CalendarEvent.SECOND', 'Second'), '3' => _t('CalendarEvent.THIRD', 'Third'), '4' => _t('CalendarEvent.FOURTH', 'Fourth'), '5' => _t('CalendarEvent.LAST', 'Last'))), new DropdownField('MonthlyDayOfWeek', '', DataList::create("RecurringDayOfWeek")->map("Value", "Title")), new LabelField($name = "ofthemonth", $title = _t("CalendarEvent.OFTHEMONTH", " of the month."))));
         $f->addFieldToTab("Root.{$recursion}", GridField::create("Exceptions", _t('CalendarEvent.ANYEXCEPTIONS', 'Any exceptions to this pattern? Add the dates below.'), $self->Exceptions(), GridFieldConfig_RecordEditor::create()));
         $dailyInterval->addExtraClass('dailyinterval');
         $weeklyInterval->addExtraClass('weeklyinterval');
         $monthlyInterval->addExtraClass('monthlyinterval');
         $monthlyIndex->addExtraClass('monthlyindex');
     });
     $f = parent::getCMSFields();
     return $f;
 }
开发者ID:helpfulrobot,项目名称:unclecheese-eventcalendar,代码行数:25,代码来源:CalendarEvent.php

示例3: 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

示例4: updateCMSFields

 /**
  * Security tab for folders
  */
 public function updateCMSFields(FieldSet &$fields)
 {
     // Only modify folder objects with parent nodes
     if (!$this->owner instanceof Folder || !$this->owner->ID) {
         return;
     }
     // Only allow ADMIN and SECURE_FILE_SETTINGS members to edit these options
     if (!Permission::checkMember(Member::currentUser(), array('ADMIN', 'SECURE_FILE_SETTINGS'))) {
         return;
     }
     $secureFilesTab = $fields->findOrMakeTab('Root.' . _t('SecureFiles.SECUREFILETABNAME', 'Security'));
     $EnableSecurityHolder = new FieldGroup();
     $EnableSecurityHolder->addExtraClass('securityFieldHolder');
     if ($this->InheritSecured()) {
         $EnableSecurityField = new ReadonlyField('InheritSecurity', '', _t('SecureFiles.INHERITED', 'This folder is inheriting security settings from a parent folder.'));
         $EnableSecurityField->addExtraClass('prependLock');
     } else {
         $EnableSecurityField = new CheckboxField('Secured', _t('SecureFiles.SECUREFOLDER', 'Folder is secure.'));
     }
     $secureFilesTab->push(new HeaderField(_t('SecureFiles.FOLDERSECURITY', 'Folder Security')));
     $EnableSecurityHolder->push($EnableSecurityField);
     $secureFilesTab->push($EnableSecurityHolder);
 }
开发者ID:hamishcampbell,项目名称:silverstripe-securefiles,代码行数:26,代码来源:SecureFileDecorator.php

示例5: getHTMLFragments

 public function getHTMLFragments($gridField)
 {
     if (!$this->checkDataType($gridField->getList())) {
         return;
     }
     $forTemplate = new ArrayData(array());
     $forTemplate->Fields = new ArrayList();
     $columns = $gridField->getColumns();
     $filterArguments = $gridField->State->GridFieldFilterHeader->Columns->toArray();
     $currentColumn = 0;
     foreach ($columns as $columnField) {
         $currentColumn++;
         $metadata = $gridField->getColumnMetadata($columnField);
         $title = $metadata['title'];
         $fields = new FieldGroup();
         if ($title && $gridField->getList()->canFilterBy($columnField)) {
             $value = '';
             if (isset($filterArguments[$columnField])) {
                 $value = $filterArguments[$columnField];
             }
             $field = new TextField('filter[' . $gridField->getName() . '][' . $columnField . ']', '', $value);
             $field->addExtraClass('ss-gridfield-sort');
             $field->addExtraClass('no-change-track');
             $field->setAttribute('placeholder', _t('GridField.FilterBy', "Filter by ") . _t('GridField.' . $metadata['title'], $metadata['title']));
             $fields->push($field);
             $fields->push(GridField_FormAction::create($gridField, 'reset', false, 'reset', null)->addExtraClass('ss-gridfield-button-reset')->setAttribute('title', _t('GridField.ResetFilter', "Reset"))->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField));
         }
         if ($currentColumn == count($columns)) {
             $fields->push(GridField_FormAction::create($gridField, 'filter', false, 'filter', null)->addExtraClass('ss-gridfield-button-filter')->setAttribute('title', _t('GridField.Filter', "Filter"))->setAttribute('id', 'action_filter_' . $gridField->getModelClass() . '_' . $columnField));
             $fields->push(GridField_FormAction::create($gridField, 'reset', false, 'reset', null)->addExtraClass('ss-gridfield-button-close')->setAttribute('title', _t('GridField.ResetFilter', "Reset"))->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField));
             $fields->addExtraClass('filter-buttons');
             $fields->addExtraClass('no-change-track');
         }
         $forTemplate->Fields->push($fields);
     }
     return array('header' => $forTemplate->renderWith('GridFieldFilterHeader_Row'));
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:37,代码来源:GridFieldFilterHeader.php

示例6: getFieldsForImage

	/**
	 * @return FieldList
	 */
	protected function getFieldsForImage($url, $file) {
		if($file instanceof Image) {
			$formattedImage = $file->FormattedImage('SetWidth', Image::$asset_preview_width);
			$thumbnailURL = $formattedImage ? $formattedImage->URL : $url;	
		} else {
			$thumbnailURL = $url;
		}
		
		$previewField = new LiteralField("ImageFull",
			"<img id='thumbnailImage' class='thumbnail-preview' src='{$thumbnailURL}?r=" . rand(1,100000)  . "' alt='{$file->Name}' />\n"
		);

		$fields = new FieldList(
			$filePreview = CompositeField::create(
				CompositeField::create(
					$previewField
				)->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'),
				CompositeField::create(
					CompositeField::create(
						new ReadonlyField("FileType", _t('AssetTableField.TYPE','File type') . ':', $file->FileType),
						new ReadonlyField("Size", _t('AssetTableField.SIZE','File size') . ':', $file->getSize()),
						$urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL','URL'),
							sprintf('<a href="%s" target="_blank">%s</a>', $file->Link(), $file->RelativeLink())
						),
						new DateField_Disabled("Created", _t('AssetTableField.CREATED','First uploaded') . ':', $file->Created),
						new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT','Last changed') . ':', $file->LastEdited)
					)
				)->setName("FilePreviewData")->addExtraClass('cms-file-info-data')
			)->setName("FilePreview")->addExtraClass('cms-file-info'),
			new TextField(
				'AltText', 
				_t('HtmlEditorField.IMAGEALTTEXT', 'Alternative text (alt) - shown if image cannot be displayed'), 
				$file->Title, 
				80
			),
			new TextField(
				'Title', 
				_t('HtmlEditorField.IMAGETITLE', 'Title text (tooltip) - for additional information about the image')
			),
			new TextField('CaptionText', _t('HtmlEditorField.CAPTIONTEXT', 'Caption text')),
			new DropdownField(
				'CSSClass',
				_t('HtmlEditorField.CSSCLASS', 'Alignment / style'),
				array(
					'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'),
					'leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'),
					'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.'),
					'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'),
				)
			),
			$dimensionsField = new FieldGroup(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'),
				$widthField = new TextField('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), $file->Width),
				$heightField = new TextField('Height', " x " . _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), $file->Height)
			)
		);
		$urlField->dontEscape = true;
		$dimensionsField->addExtraClass('dimensions');
		$widthField->setMaxLength(5);
		$heightField->setMaxLength(5);

		$this->extend('updateFieldsForImage', $fields, $url, $file);

		return $fields;
	}
开发者ID:redema,项目名称:sapphire,代码行数:67,代码来源:HtmlEditorField.php

示例7: getFormField

 public function getFormField()
 {
     $map_groups = $this->getMC('groups');
     // debug::show($map_groups);
     if (count($map_groups) > 1) {
         Requirements::javascript(MOD_DOAP_DIR . "/javascript/newsletter.js");
         $f = new FieldGroup($a = new CheckboxField($this->Name, $this->Title, $this->getSetting('Default')), new CheckboxSetField('Themes', 'Themen abonnieren', $map_groups));
         $a->addExtraClass('newsletter-toggle');
     }
     $f->addExtraClass('newsletter-group');
     return $f;
 }
开发者ID:helpfulrobot,项目名称:lerni-editablemailchimpsubscriptionfield,代码行数:12,代码来源:NewsletterSignup.php

示例8: 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

示例9: getHTMLFragments

 public function getHTMLFragments($gridField)
 {
     $fields = new ArrayList();
     $state = $gridField->State->UserFormsGridField;
     $selectedField = $state->filter;
     $selectedValue = $state->value;
     // show dropdown of all the fields available from the submitted form fields
     // that have been saved. Takes the titles from the currently live form.
     $columnField = new DropdownField('FieldNameFilter', '');
     $columnField->setSource($this->columns);
     $columnField->setEmptyString(_t('UserFormsGridFieldFilterHeader.FILTERSUBMISSIONS', 'Filter Submissions..'));
     $columnField->setHasEmptyDefault(true);
     $columnField->setValue($selectedField);
     $valueField = new TextField('FieldValue', '', $selectedValue);
     $columnField->addExtraClass('ss-gridfield-sort');
     $columnField->addExtraClass('no-change-track');
     $valueField->addExtraClass('ss-gridfield-sort');
     $valueField->addExtraClass('no-change-track');
     $valueField->setAttribute('placeholder', _t('UserFormsGridFieldFilterHeader.WHEREVALUEIS', 'where value is..'));
     $fields->push(new FieldGroup(new CompositeField($columnField, $valueField)));
     $fields->push(new FieldGroup(new CompositeField($start = new DateField('StartFilter', 'From'), $end = new DateField('EndFilter', 'Till'))));
     foreach (array($start, $end) as $date) {
         $date->setConfig('showcalendar', true);
         $date->setConfig('dateformat', 'y-mm-dd');
         $date->setConfig('datavalueformat', 'y-mm-dd');
         $date->addExtraClass('no-change-track');
     }
     $end->setValue($state->end);
     $start->setValue($state->start);
     $fields->push($actions = new FieldGroup(GridField_FormAction::create($gridField, 'filter', false, 'filter', null)->addExtraClass('ss-gridfield-button-filter')->setAttribute('title', _t('GridField.Filter', "Filter"))->setAttribute('id', 'action_filter_' . $gridField->getModelClass() . '_' . $columnField), GridField_FormAction::create($gridField, 'reset', false, 'reset', null)->addExtraClass('ss-gridfield-button-close')->setAttribute('title', _t('GridField.ResetFilter', "Reset"))->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField)));
     $actions->addExtraClass('filter-buttons');
     $actions->addExtraClass('no-change-track');
     $forTemplate = new ArrayData(array('Fields' => $fields));
     return array('header' => $forTemplate->renderWith('GridFieldFilterHeader_Row'));
 }
开发者ID:8secs,项目名称:cocina,代码行数:35,代码来源:UserFormsGridFieldFilterHeader.php


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