本文整理汇总了PHP中CompositeField类的典型用法代码示例。如果您正苦于以下问题:PHP CompositeField类的具体用法?PHP CompositeField怎么用?PHP CompositeField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CompositeField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Order');
$fields->removeByName('Title');
$fields->removeByName('ProcessInfo');
$fields->removeByName('ParentProcessID');
$fields->addFieldToTab('Root.Main', $processSteps = new CompositeField($title = new TextField('Title', 'Title')));
$title->addExtraClass('process-noborder');
$processSteps->addExtraClass('process-step');
$fields->addFieldToTab('Root.Main', $processSteps = new CompositeField(new GridField('ProcessInfo', 'Information for this case', $this->ProcessInfo(), GridFieldConfig_RecordViewer::create())));
$processes = Process::get();
if ($processes) {
$fields->insertAfter($inner = new CompositeField(new LiteralField('ExplainStop', '<label class="right">This must be set after you create a process</label>'), $processesOptions = new DropdownField('ParentProcessID', 'Process', $processes->map('ID', 'Title'))), 'Title');
$inner->addExtraClass('message special');
}
$processSteps->addExtraClass('process-step');
$fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
<span class="step-label">
<span class="flyout">0.1</span><span class="arrow"></span>
<span class="title">Case details</span>
</span>
</h3>'), 'Title');
$fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
<span class="step-label">
<span class="flyout">0.2</span><span class="arrow"></span>
<span class="title">Associated Information Pieces</span>
</span>
</h3>'), 'ProcessInfo');
return $fields;
}
示例2: UpdateCMSFields
public function UpdateCMSFields(FieldList $fields)
{
if ($this->IsInSocialMedia()) {
$fields->addFieldToTab('Root.Main', $text = new CompositeField(), 'Content');
$text->setDescription('Tämä blogiartikkeli on julkaistu sosiaalisessa mediassa. Muutokset blogiin eivät enää päivity sosiaaliseen mediaan. Jos poistat blogin, se ei poistu somesta automaattisesti.');
} else {
$fields->addFieldToTab('Root.Main', $checkbox = new CheckboxField('PublishInSocialMedia', 'Julkaise sosiaalisessa mediassa'), 'Content');
$checkbox->setDescription('Julkaisu tapahtuu kun klikkaat "Tallenna ja julkaise". Jos teet muutoksia sisältöön ensimmäisen some-julkaisun jälkeen, muutokset päivittyvät ainoastaan blogiin, eivätkä mene someen. Jos poistat artikkelin, se täytyy käydä erikseen poistamassa somessa.');
}
}
示例3: testLegend
public function testLegend()
{
$composite = new CompositeField(new TextField('A'), new TextField('B'));
$composite->setTag('fieldset');
$composite->setLegend('My legend');
$parser = new CSSContentParser($composite->Field());
$root = $parser->getBySelector('fieldset.composite');
$legend = $parser->getBySelector('fieldset.composite legend');
$this->assertNotNull($legend);
$this->assertEquals('My legend', (string) $legend[0]);
}
示例4: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Archived');
$fields->removeByName('Sort');
$fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this news item?"), new CheckboxField('Archived', '')));
$group->addExtraClass("field special");
$label->addExtraClass("left");
$fields->removeByName('ParentID');
return $fields;
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Archived');
$fields->removeByName('Sort');
$fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this news item?"), new CheckboxField('Archived', '')));
$group->addExtraClass("field special");
$label->addExtraClass("left");
$fields->removeByName('ParentID');
$fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Title");
return $fields;
}
示例6: PopupForm
function PopupForm()
{
$form = new Form($this, "{$this->name}/PopupForm", new FieldList($headerWrap = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', 'Edit Source'))), $codeField = new CodeEditorField('TinyMCESource', '')), new FieldList(ResetFormAction::create('cancel', 'Cancel')->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true), FormAction::create('update', 'Update')->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
$headerWrap->addExtraClass('CompositeField composite cms-content-header nolabel ');
// $contentComposite->addExtraClass('tinymce-codeeditor-field content');
$codeField->addExtraClass('nolabel stacked');
$form->unsetValidator();
$form->loadDataFrom($this);
$form->addExtraClass('htmleditorfield-form htmleditorfield-codeform cms-dialog-content');
// $this->extend('updateLinkForm', $form);
return $form;
}
示例7: testFieldPosition
function testFieldPosition()
{
$compositeOuter = new CompositeField(new TextField('A'), new TextField('B'), $compositeInner = new CompositeField(new TextField('C1'), new TextField('C2')), new TextField('D'));
$this->assertEquals(0, $compositeOuter->fieldPosition('A'));
$this->assertEquals(1, $compositeOuter->fieldPosition('B'));
$this->assertEquals(3, $compositeOuter->fieldPosition('D'));
$this->assertEquals(0, $compositeInner->fieldPosition('C1'));
$this->assertEquals(1, $compositeInner->fieldPosition('C2'));
$compositeOuter->insertBefore(new TextField('AB'), 'B');
$this->assertEquals(0, $compositeOuter->fieldPosition('A'));
$this->assertEquals(1, $compositeOuter->fieldPosition('AB'));
$this->assertEquals(2, $compositeOuter->fieldPosition('B'));
}
示例8: __construct
public function __construct($controller, $name)
{
$fields = new FieldList($dataFields = new CompositeField(TextField::create("Name", _t('ContactForm.YOURNAME', 'Your name'))->setCustomValidationMessage(_t('ContactForm.YOURNAME_MESSAGE_REQUIRED', 'Please enter your name'))->setAttribute('data-message-required', _t('ContactForm.YOURNAME_MESSAGE_REQUIRED', 'Please enter your name')), EmailField::create("Email", _t('ContactController.EMAILADDRESS', "Your email address"))->setCustomValidationMessage(_t('ContactForm.EMAILADDRESS_MESSAGE_REQUIRED', 'Please enter your email address'))->setAttribute('data-message-required', _t('ContactForm.EMAILADDRESS_MESSAGE_REQUIRED', 'Please enter your email address'))->setAttribute('data-message-email', _t('ContactForm.EMAILADDRESS_MESSAGE_EMAIL', 'Please enter a valid email address')), TextareaField::create("Comment", _t('ContactController.COMMENTS', "Comments"))->setCustomValidationMessage(_t('ContactForm.COMMENT_MESSAGE_REQUIRED', 'Please enter your comment'))->setAttribute('data-message-required', _t('ContactForm.COMMENT_MESSAGE_REQUIRED', 'Please enter your comment'))), HiddenField::create("ReturnURL"));
$dataFields->addExtraClass('data-fields');
// save actions
$actions = new FieldList(new FormAction("doPostContact", _t('ContactForm.POST', 'Post')));
// required fields for server side
$required = new RequiredFields(array('Name', 'Email', 'Comment'));
$this->setAttribute('novalidate', 'novalidate');
// Set it so the user gets redirected back down to the form upon form fail
//$this->setRedirectToFormOnValidationError(true);
parent::__construct($controller, $name, $fields, $actions, $required);
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Archived');
$fields->addFieldToTab('Root.Main', new TreeDropdownField('LinkID', 'Link', 'SiteTree'));
$fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this carousel item?"), new CheckboxField('Archived', '')));
$group->addExtraClass("field special");
$label->addExtraClass("left");
$fields->removeByName('ParentID');
$fields->insertBefore($wrap = new CompositeField($extraLabel = new LabelField('Note', "Note: You will need to create the carousel item before you can add an image")), 'Image');
$wrap->addExtraClass('alignExtraLabel');
return $fields;
}
示例10: getColumnContent
public function getColumnContent($gridField, $record, $columnName)
{
if (!$record->canEdit()) {
return;
}
$field = new CompositeField();
if (!$record instanceof ElementVirtualLinked) {
$field->push(GridField_FormAction::create($gridField, 'UnlinkRelation' . $record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-unlink')->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))->setAttribute('data-icon', 'chain--minus'));
}
if ($record->canDelete() && $record->VirtualClones()->count() == 0) {
$field->push(GridField_FormAction::create($gridField, 'DeleteRecord' . $record->ID, false, "deleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete')));
}
return $field->Field();
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Archived');
$fields->removeByName('Sort');
$fields->insertAfter(LinkField::create('LinkID', 'Link'), "Title");
$fields->insertAfter($altText = TextField::create('AltText', 'Alternative text'), "Title");
$altText->setDescription("e.g. Sign up now!");
$fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this promotional item?"), new CheckboxField('Archived', '')));
$group->addExtraClass("field special");
$label->addExtraClass("left");
$fields->removeByName('ParentID');
return $fields;
}
示例12: 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;
}
示例13: getCMSFields
/**
* getCMSFields
* Construct the FieldList used in the CMS. To provide a
* smarter UI we don't use the scaffolding provided by
* parent::getCMSFields.
*
* @return FieldList
*/
public function getCMSFields()
{
Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
//Create the FieldList and push the Root TabSet on to it.
$fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create($this->SystemName), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("This is the name your customers would see against this courier."), DropdownField::create("Enabled", "Enable this courier?", array("0" => "No", "1" => "Yes"))->setEmptyString("(Select one)")->setRightTitle("Can customers use this courier?")))));
return $fields;
}
示例14: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet("Root", new Tab("Main", TextField::create("Title", "Title"), GridField::create("Slides", "Nivo Slide", $this->Slides(), GridFieldConfig_RecordEditor::create())), new Tab("Advanced", DropdownField::create("Theme", "Theme", self::get_all_themes()), DropdownField::create("Effect", "Effect", $this->dbObject("Effect")->enumValues()), NumericField::create("AnimationSpeed", "Animation Speed")->setDescription("Animation speed in milliseconds."), NumericField::create("PauseTime", "Pause Time")->setDescription("Pause time on each frame in milliseconds."), TextField::create("PrevText", "Previous Text"), TextField::create("NextText", "Next Text"), NumericField::create("Slices", "Slices")->setDescription("Number of slices for slice animation effects."), NumericField::create("BoxCols", "Box Columns")->setDescription("Number of box columns for box animation effects."), NumericField::create("BoxRows", "Box Rows")->setDescription("Number of box rows for box animation effects."), NumericField::create("StartSlide", "Start Slide")->setDescription("Slide to start on (0 being the first)."), HeaderField::create("ControlHeading", "Control Options", 4), CompositeField::create(array(CheckboxField::create("DirectionNav", "Display Direction Navigation?"), CheckboxField::create("ControlNav", "Display Control Navigation?"), CheckboxField::create("ControlNavThumbs", "Use thumbnails for control nav?"), CheckboxField::create("PauseOnHover", "Stop the animation whilst hovering?"), CheckboxField::create("ManualAdvance", "Force manual transition?"), CheckboxField::create("RandomStart", "Random Start?"))))));
$fields->extend("updateCMSFields", $fields);
return $fields;
}
示例15: getCMSFields
/**
* getCMSFields
* Construct the FieldList used in the CMS. To provide a
* smarter UI we don't use the scaffolding provided by
* parent::getCMSFields.
*
* @return FieldList
*/
public function getCMSFields()
{
Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
//Create the FieldList and push the Root TabSet on to it.
$fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Order Status"), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("The name of your custom order status. i.e. Pending, Awaiting Stock."), TextareaField::create("Content", "Friendly Description")->setRightTitle("This will be shown to your customers. What do you wish to tell them about this status?")))));
return $fields;
}