本文整理汇总了PHP中CompositeField::addExtraClass方法的典型用法代码示例。如果您正苦于以下问题:PHP CompositeField::addExtraClass方法的具体用法?PHP CompositeField::addExtraClass怎么用?PHP CompositeField::addExtraClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompositeField
的用法示例。
在下文中一共展示了CompositeField::addExtraClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCompositeField
/**
* @return Comosite FieldSet with Categorys and Items
*/
function getCompositeField()
{
//create new composite field group for each category
$oCatFieldSet = new CompositeField();
// Set the field group ID
$oCatFieldSet->setID('Cat' . $this->ID);
$oCatFieldSet->addExtraClass('category');
//create new composite field group for each category
$oCatField = new TextField($this->ID . '_' . $this->FieldName, $this->Title, null, null);
$oCatField->addExtraClass('category-field');
//Add Category Percentage Field to the Form
$oCatFieldSet->push($oCatField);
if ($this->Description) {
$oCatDescField = new LiteralField($this->ID . '_Description', '<p class="category-field-desc">' . $this->Description . '</p>');
$oCatDescField->addExtraClass('category-field');
$oCatFieldSet->push($oCatDescField);
}
//Add item Composite Field to this Composite Field
//now get all of the items matched with this category
$oFormCategoryItems = self::FormCategoryItems();
foreach ($oFormCategoryItems as $item) {
$oCatFieldSet->push($item->getFormField());
}
return $oCatFieldSet;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例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: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$gateways = GatewayInfo::get_supported_gateways();
$amountfields = $this->Fields()->map("ID", "Title");
$fields->addFieldsToTab("Root.Payment", array(DropdownField::create("PaymentAmountFieldID", "Payment Amount Field", $amountfields)->setDescription("This must return a value like 20.00 (no dollar sign)"), new DropdownField("PaymentGateway", "Payment Gateway", $gateways), new TextField("PaymentCurrency", "Payment Currency"), new CheckboxField("PaymentFields_Card", "Show Card Fields"), new CheckboxField("PaymentFields_Billing", "Show Billing Fields"), new CheckboxField("PaymentFields_Shipping", "Show Shipping Fields"), new CheckboxField("PaymentFields_Company", "Show Company Fields"), new CheckboxField("PaymentFields_Email", "Show Email Fields")));
// text to show on error
$onErrorFieldSet = new CompositeField($label = new LabelField('OnErrorMessageLabel', _t('UserDefinedForm.ONERRORLABEL', 'Show on error')), $editor = new HtmlEditorField("OnErrorMessage", "", _t('UserDefinedForm.ONERRORMESSAGE', $this->OnErrorMessage)));
$onErrorFieldSet->addExtraClass('field');
$fields->insertAfter($onErrorFieldSet, "OnCompleteMessage");
return $fields;
}
开发者ID:helpfulrobot,项目名称:souldigital-silverstripe-userforms-payments,代码行数:12,代码来源:UserDefinedPaymentForm.php
示例7: 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;
}
示例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->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;
}
示例10: 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;
}
示例11: updateMediaForm
/**
* Don't pass $form in by reference, as doing so and adding a field creates both a div and an
* input with identical IDs - which is both invalid HTML and breaks the ability to click on the
* label and focus on the input
*/
public function updateMediaForm($form)
{
Requirements::javascript(HTMLEDITORIFRAME_BASE . '/javascript/HtmlEditorField_Iframe.js');
Requirements::css(HTMLEDITORIFRAME_BASE . '/css/HtmlEditorField_Iframe.css');
$numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span>' . '<strong class="title">%s</strong></span>';
$fromIframe = new CompositeField(new LiteralField('headerIframe', '<h4>' . sprintf($numericLabelTmpl, '1', "Iframe URL") . '</h4>'), $iframeURL = new TextField('IframeURL', 'http://'), new LiteralField('addIframeImage', '<button class="action ui-action-constructive ui-button field add-iframe" data-icon="addMedia">Add url</button>'));
$iframeURL->addExtraClass('iframeurl');
$fromIframe->addExtraClass('content ss-uploadfield from-web');
// $fields->dataFieldByName() doesn't appear to work
$fields = $form->Fields();
$tabset = $fields[1]->fieldByName("MediaFormInsertMediaTabs");
$tabset->push($iFrameTab = new Tab('From an Iframe', $fromIframe));
$iFrameTab->addExtraClass('htmleditorfield-from-iframe');
return $form;
}
示例12: getCMSFields
/**
* Returns a FieldList of cms form fields that is the main form for editing this DataObject
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Hide these from editing
$fields->removeByName('ParentID');
$fields->removeByName('Sort');
$image = $fields->dataFieldByName('SplashImage');
$image->setFolderName('Uploads/Splash-Images');
$fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Title");
$fields->removeByName('HideFromRegionLists');
// Archived
$fields->removeByName('Archived');
$fields->addFieldToTab('Root.Main', $group = new CompositeField($labelHide = new LabelField("LabelHideFromRegionLists", "Hide from region lists?"), new CheckboxField('HideFromRegionLists', "e.g. if you need a region for an event that isn't a branch location"), $label = new LabelField("LabelArchive", "Archive this region?"), new CheckboxField('Archived', '')));
$labelHide->addExtraClass("left");
$group->addExtraClass("special field");
$label->addExtraClass("left");
return $fields;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertAfter($gameFormContent = new HTMLEditorField('GameLiveContent', 'Game selection form detail'), 'Content');
$gameFormContent->setRows(20);
$regOpen = new CheckboxField('OpenGameReg', '');
$fields->insertBefore($cField = new CompositeField(array($label = new LabelField('OpenGameRegLabel', 'Open game selection (all)'), $regOpen)), 'Content');
$cField->addExtraClass('field');
$regOpen->addExtraClass('mts');
$label->addExtraClass('left');
$groupsMap = array();
foreach (Group::get() as $group) {
// Listboxfield values are escaped, use ASCII char instead of »
$groupsMap[$group->ID] = $group->getBreadcrumbs(' > ');
}
asort($groupsMap);
$fields->insertBefore(ListboxField::create('OpenGameRegForGroups', "Open game selection for group (limited)")->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('Member.ADDGROUP', 'Add group', 'Placeholder text for a dropdown')), 'Content');
return $fields;
}
示例14: getCMSFields
/**
* Returns a FieldList of cms form fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Hide these from editing
$fields->removeByName('ParentID');
$fields->removeByName('Sort');
//Remove to re-add
$fields->removeByName('Type');
$fields->removeByName('LinkLabel');
$content = $fields->dataFieldByName('Content');
$numberToDisplay = $fields->dataFieldByName('NumberToDisplay');
$projectPage = $fields->dataFieldByName('ProjectPageID');
$html = $fields->dataFieldByName('HTML');
$subtitle = $fields->dataFieldByName('SubTitle');
$html->setRows(20);
$html->addExtraClass('no-pagebreak');
$link = $fields->dataFieldByName('LinkID');
$image = $fields->dataFieldByName('Image');
$image->setFolderName('Uploads/Small-Images');
$fields->removeByName('Image');
$fields->insertBefore($projectPage, 'Content');
$fields->insertAfter($type = OptionSetField::create("Type", "Type", $this->dbObject('Type')->enumValues()), "Colour");
$type->addExtraClass('inline-short-list');
$fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Title");
$fields->insertAfter($linkLabel = new TextField("LinkLabel", "Link Label"), "LinkID");
$fields->insertAfter($imageLogin = DisplayLogicWrapper::create($image), 'LinkLabel');
$imageLogin->hideUnless("Type")->isEqualTo("Content");
$html->hideUnless("Type")->isEqualTo("HTML");
$subtitle->hideUnless("Type")->isEqualTo("HTML");
$link->hideUnless("Type")->isEqualTo("Content")->orIf("Type")->isEqualTo("Project");
$linkLabel->hideUnless("LinkID")->isGreaterThan(0)->andIf("Type")->isEqualTo("Content");
$numberToDisplay->hideIf("Type")->isEqualTo("Content")->orIf("Type")->isEqualTo("HTML");
$projectPage->hideUnless("Type")->isEqualTo("Project");
$content->hideUnless("Type")->isEqualTo("Content");
// Archived
$fields->removeByName('Archived');
$fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this feature?"), new CheckboxField('Archived', '')));
$group->addExtraClass("special field");
$label->addExtraClass("left");
return $fields;
}
示例15: ImageForm
/**
* @return Form
*/
public function ImageForm()
{
Requirements::css('framework/admin/thirdparty/jquery-notice/jquery.notice.css');
Requirements::css('framework/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css('framework/admin/thirdparty/chosen/chosen/chosen.css');
Requirements::css('framework/thirdparty/jstree/themes/apple/style.css');
Requirements::css('framework/css/TreeDropdownField.css');
Requirements::css('framework/css/GridField.css');
Requirements::css('framework/admin/css/screen.css');
Requirements::css('site/css/cms.css');
Requirements::css('dashboard/css/dashboard_icon.css');
Requirements::css('userforms/css/FieldEditor.css');
Requirements::css('cms/css/screen.css');
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
Requirements::javascript('framework/thirdparty/jquery-ui/jquery-ui.js');
Requirements::javascript('framework/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript('framework/thirdparty/jquery-cookie/jquery.cookie.js');
Requirements::javascript('framework/javascript/GridField.js');
Requirements::javascript('framework/admin/javascript/leaktools.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.Layout.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.ActionTabSet.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.Panel.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.Tree.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.Content.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.EditForm.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.Menu.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.Preview.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.BatchActions.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.FieldHelp.js');
Requirements::javascript('framework/admin/javascript/LeftAndMain.TreeDropdownField.js');
Requirements::javascript('framework/javascript/lang/en.js');
$numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span>' . '<strong class="title">%s</strong></span>';
$form = new Form($this, "ImageForm", new FieldList($contentComposite = new CompositeField(new LiteralField('Step1', '<div class="step1">' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.SELECTIMAGE', 'Select Image')) . '</div>'), CloudinaryImageField::create('Image')->addExtraClass('markdown-popup'), new LiteralField('Step2', '<div class="step2">' . sprintf($numericLabelTmpl, '2', _t('HtmlEditorField.DETAILS', 'Details')) . '</div>'), NumericField::create('Width'), NumericField::create('Height'), TextField::create('AltText')->setTitle('Alter Text'))), new FieldList(FormAction::create('insert', _t('HtmlEditorField.BUTTONINSERTIMAGE', 'Insert Image'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
$contentComposite->addExtraClass('ss-insert-image content ss-insert-media');
$form->unsetValidator();
$form->loadDataFrom($this);
$form->addExtraClass('markdownfield-form markdowneditorfield-imageform ');
return $form;
}
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-markdown,代码行数:43,代码来源:MarkdownCloudinaryUpload.php