本文整理汇总了PHP中GridField::addExtraClass方法的典型用法代码示例。如果您正苦于以下问题:PHP GridField::addExtraClass方法的具体用法?PHP GridField::addExtraClass怎么用?PHP GridField::addExtraClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridField
的用法示例。
在下文中一共展示了GridField::addExtraClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
public function getCMSFields()
{
$fields = singleton('DataObject')->getCMSFields();
$fields->addFieldsToTab('Root.Main', array(new ReadonlyField('SubmittedBy', 'Submitted By'), new ReadonlyField('IPAddress', 'IP Address'), new ReadonlyField('Created', 'Time Submitted'), new ReadonlyField('StatusMessages'), $field = new GridField('Values', 'Responses', $this->Values(), new GridFieldConfig_FlexiFormSubmissionValues())));
$field->addExtraClass('flexiform');
return $fields;
}
示例2: getHTMLFragments
/**
* @param GridField $field
*/
public function getHTMLFragments($field)
{
VersionedGridFieldExtensions::include_requirements();
$field->addExtraClass('ss-versioned-gridfield-orderable');
$field->setAttribute('data-url-reorder', $field->Link('reorder'));
$field->setAttribute('data-url-movetopage', $field->Link('movetopage'));
}
开发者ID:phil-quinn,项目名称:silverstripe-versioneddataobjects,代码行数:10,代码来源:VersionedGridFieldOrderableRows.php
示例3: getHTMLFragments
/**
* @param GridField $field
*/
public function getHTMLFragments($field)
{
self::include_requirements();
// set ajax urls / vars
$field->addExtraClass('ss-gridfield-blockenhancements');
// $field->setAttribute('data-url-area-assignment', $field->Link('area_assignment'));
$field->setAttribute('data-url-blocktype-assignment', $field->Link('blocktype_assignment'));
// $field->setAttribute('data-block-area-none-title', Config::inst()->get(get_class(), 'unassigned_area_description'));
// add no-chozen to dropdown
// $field->getConfig()->getComponentByType('GridFieldAddNewMultiClass')->
// $field->getConfig()->getComponentByType('GridFieldDetailForm')->setAttribute('data-project-dir', project());
}
示例4: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Order');
$fields->removeByName('ProcessInfo');
$fields->removeByName('StopStageID');
$fields->removeByName('StopButton');
$fields->removeByName('ContinueButton');
$fields->removeByName('DecisionPoint');
$fields->removeByName('CaseFinal');
$fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
<span class="step-label">
<span class="flyout">3</span><span class="arrow"></span>
<span class="title">Stage Settings</span>
</span>
</h3>'), 'Title');
$caseFinalMap = ProcessCase::get()->filter(array('ParentProcessID' => $this->ParentID))->map("ID", "Title")->toArray();
asort($caseFinalMap);
$case = ListboxField::create('CaseFinal', 'Final step for these Cases')->setMultiple(true)->setSource($caseFinalMap)->setAttribute('data-placeholder', _t('ProcessAdmin.Cases', 'Cases', 'Placeholder text for a dropdown'));
$fields->insertAfter($case, 'Title');
$fields->insertAfter($group = new CompositeField($label = new LabelField('switchLabel', 'Act as Decision Point'), new CheckboxField('DecisionPoint', '')), 'ParentID');
$group->addExtraClass("field special process-noborder");
$label->addExtraClass("left");
$fields->dataFieldByName('Content')->setRows(10);
if ($this->ID > 0) {
$fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p></p>'));
$fields->addFieldToTab('Root.Main', $processInfo = new CompositeField($grid = new GridField('ProcessInfo', 'Information for this stage', $this->ProcessInfo()->sort(array('TypeID' => 'ASC', 'ProcessCaseID' => 'ASC', 'LinksToAnotherStageID' => 'ASC')), $gridConfig = GridFieldConfig_RelationEditor::create())));
$gridConfig->addComponent(new GridFieldSortableRows('Order'));
$processInfo->addExtraClass('process-spacing');
$grid->addExtraClass('toggle-grid');
} else {
$fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p class="message info">Save this stage to add info</p>'));
}
$fields->insertBefore(new LiteralField('StageTitleInfo', '<h3 class="process-info-header">
<span class="step-label">
<span class="flyout">4</span><span class="arrow"></span>
<span class="title">Information</span>
</span>
</h3>'), 'SaveRecord');
$stopStage = ProcessStopStage::get();
if ($stopStage) {
$fields->insertBefore($inner = new CompositeField(new LiteralField('Decision', '<h3>Decision Point</h3>'), new LiteralField('ExplainStop', '<label class="right">Choose a stop stage if you would like this stage to act as a decision point</label>'), $stop = new DropdownField('StopStageID', 'Stop Stage', $stopStage->map('ID', 'Title')), $continue = new TextField('ContinueButton', 'Button: Continue (e.g. "Yes")'), new TextField('StopButton', 'Button: Stop (e.g. "No")')), 'ProcessInfo');
$stop->setEmptyString('No stop after this stage');
$inner->addExtraClass('message special toggle-decide');
$continue->addExtraClass('process-noborder');
$stop->addExtraClass('process-noborder');
}
return $fields;
}
示例5: getEditForm
public function getEditForm($id = null, $fields = null)
{
$report = $this->reportObject;
if ($report) {
$fields = $report->getCMSFields();
} else {
// List all reports
$fields = new FieldList();
$gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldFooter());
$gridField = new GridField('Reports', false, $this->Reports(), $gridFieldConfig);
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array('title' => _t('ReportAdmin.ReportTitle', 'Title')));
$columns->setFieldFormatting(array('title' => '<a href=\\"$Link\\" class=\\"cms-panel-link\\">$value ($Count)</a>'));
$gridField->addExtraClass('all-reports-gridfield');
$fields->push($gridField);
}
$actions = new FieldList();
$form = new Form($this, "EditForm", $fields, $actions);
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
$form->loadDataFrom($this->request->getVars());
$this->extend('updateEditForm', $form);
return $form;
}
示例6: getEditForm
public function getEditForm($id = null, $fields = null) {
$fields = new FieldList();
$report = $this->reportObject;
if($report) {
// List all reports
$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(),
new GridFieldPrintButton(),
new GridFieldExportButton()
);
$gridField = new GridField('Report',$report->title(), $report->sourceRecords(array(), null, null), $gridFieldConfig);
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$displayFields = array();
$fieldCasting = array();
$fieldFormatting = array();
// Parse the column information
foreach($report->columns() as $source => $info) {
if(is_string($info)) $info = array('title' => $info);
if(isset($info['formatting'])) $fieldFormatting[$source] = $info['formatting'];
if(isset($info['csvFormatting'])) $csvFieldFormatting[$source] = $info['csvFormatting'];
if(isset($info['casting'])) $fieldCasting[$source] = $info['casting'];
if(isset($info['link']) && $info['link']) {
$link = singleton('CMSPageEditController')->Link('show');
$fieldFormatting[$source] = '<a href=\"' . $link . '/$ID\">$value</a>';
}
$displayFields[$source] = isset($info['title']) ? $info['title'] : $source;
}
$columns->setDisplayFields($displayFields);
$columns->setFieldCasting($fieldCasting);
$columns->setFieldFormatting($fieldFormatting);
$fields->push($gridField);
} else {
// List all reports
$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldFooter()
);
$gridField = new GridField('Reports','Reports', $this->Reports(), $gridFieldConfig);
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array(
'title' => 'Title',
));
$columns->setFieldFormatting(array(
'title' => '<a href=\"$Link\" class=\"cms-panel-link\">$value</a>'
));
$gridField->addExtraClass('all-reports-gridfield');
$fields->push($gridField);
}
$actions = new FieldList();
$form = new Form($this, "EditForm", $fields, $actions);
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
$this->extend('updateEditForm', $form);
return $form;
}
示例7: ListForm
/**
* Returns a GridField of messages
* @return CMSForm
*/
public function ListForm()
{
$fields = new FieldList();
$gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldFooter());
$gridField = new GridField('SearchResults', _t('MandrillAdmin.SearchResults', 'Search Results'), $this->Messages(), $gridFieldConfig);
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array('date' => _t('MandrillAdmin.MessageDate', 'Date'), 'state' => _t('MandrillAdmin.MessageStatus', 'Status'), 'sender' => _t('MandrillAdmin.MessageSender', 'Sender'), 'email' => _t('MandrillAdmin.MessageEmail', 'Email'), 'subject' => _t('MandrillAdmin.MessageSubject', 'Subject'), 'opens' => _t('MandrillAdmin.MessageOpens', 'Opens'), 'clicks' => _t('MandrillAdmin.MessageClicks', 'Clicks')));
$columns->setFieldFormatting(array('subject' => function ($value, &$item) {
return sprintf('<a href="%s" class="cms-panel-link" data-pjax-target="Content">%s</a>', Convert::raw2xml($item->Link), $value);
}, 'state' => function ($value, &$item) {
$color = MandrillMessage::getColorForState($value);
return sprintf('<span style="color:%s">%s</span>', $color, $value);
}));
$gridField->addExtraClass('all-messages-gridfield');
$fields->push($gridField);
$actions = new FieldList();
$form = CMSForm::create($this, "ListForm", $fields, $actions)->setHTMLID('Form_ListForm');
$form->setResponseNegotiator($this->getResponseNegotiator());
return $form;
}
示例8: getEditForm
public function getEditForm($id = null, $fields = null)
{
$report = $this->reportObject;
if ($report) {
$fields = $report->getCMSFields();
} else {
// List all reports
$fields = new FieldList();
$gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldFooter());
$gridField = new GridField('Reports', false, $this->Reports(), $gridFieldConfig);
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array('title' => _t('ReportAdmin.ReportTitle', 'Title')));
$columns->setFieldFormatting(array('title' => function ($value, &$item) {
return sprintf('<a href="%s" class="cms-panel-link">%s</a>', Convert::raw2xml($item->Link), Convert::raw2xml($value));
}));
$gridField->addExtraClass('all-reports-gridfield');
$fields->push($gridField);
}
$actions = new FieldList();
$form = CMSForm::create($this, "EditForm", $fields, $actions)->setHTMLID('Form_EditForm');
$form->setResponseNegotiator($this->getResponseNegotiator());
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
$form->loadDataFrom($this->request->getVars());
$this->extend('updateEditForm', $form);
return $form;
}
示例9: getColumnAttributes
/**
* Attributes for the element containing the content returned by {@link getColumnContent()}.
*
* @param \GridField $gridField
* @param \DataObject $record displayed in this row
* @param string $columnName
*
* @return array
*/
public function getColumnAttributes($gridField, $record, $columnName)
{
\Requirements::css(SS_MWM_DIR . '/thirdparty/font-awesome/font-awesome.min.css');
Utilities::include_requirements();
$gridField->addExtraClass('ss-gridfield-editable-rows');
if ($this->disableToggleStateSave) {
$gridField->addExtraClass('ss-gridfield-editable-rows_disableToggleState');
}
if ($this->cacheToggleStateSave) {
$gridField->addExtraClass('ss-gridfield-editable-rows_allowCachedToggles');
}
$this->workingGrid = $gridField;
return ['data-link' => $this->Link('load', $record->ID), 'class' => 'ss-gridfield-editable-row--icon-holder'];
}
示例10: getHTMLFragments
/**
* @param GridField $field
*/
public function getHTMLFragments($field)
{
if (!$field->getConfig()->getComponentByType('GridFieldOrderableRows')) {
user_error("GridFieldGroupable requires a GridFieldOrderableRows component", E_USER_WARNING);
}
self::include_requirements();
// set ajax urls / vars
$field->addExtraClass('ss-gridfield-groupable');
$field->setAttribute('data-url-group-assignment', $field->Link('group_assignment'));
// setoptions [groupUnassignedName, groupFieldLabel, groupField, groupsAvailable]
$field->setAttribute('data-groupable-unassigned', $this->getOption('groupUnassignedName'));
$field->setAttribute('data-groupable-role', $this->getOption('groupFieldLabel'));
$field->setAttribute('data-groupable-itemfield', $this->getOption('groupField'));
$field->setAttribute('data-groupable-groups', json_encode($this->getOption('groupsAvailable')));
}
示例11: getHTMLFragments
/**
* @param GridField $field
*/
public function getHTMLFragments($field)
{
GridFieldExtensions::include_requirements();
$field->addExtraClass('ss-gridfield-orderable');
$field->setAttribute('data-immediate-update', (string) (int) $this->immediateUpdate);
$field->setAttribute('data-url-reorder', $field->Link('reorder'));
$field->setAttribute('data-url-movetopage', $field->Link('movetopage'));
}