本文整理汇总了PHP中TextField::addExtraClass方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::addExtraClass方法的具体用法?PHP TextField::addExtraClass怎么用?PHP TextField::addExtraClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::addExtraClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name, $title = null, $value = null, $form = null)
{
$allowed_types = $this->stat('allowed_types');
$field_types = $this->stat('field_types');
if (empty($allowed_types)) {
$allowed_types = array_keys($field_types);
}
$field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types));
$field->setEmptyString('Please choose the Link Type');
$this->composite_fields['Type'] = $field;
foreach ($allowed_types as $type) {
$def = $field_types[$type];
$field_name = "{$name}[{$type}]";
switch ($def['field']) {
case 'TreeDropdownField':
$field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title');
break;
default:
$field = new TextField($field_name, '');
break;
}
$field->setDescription($def['description']);
$field->addExtraClass('FlexiLinkCompositeField');
$this->composite_fields[$type] = $field;
}
$this->setForm($form);
parent::__construct($name, $title, $value, $form);
}
示例2: FieldList
function __construct($controller, $name, $use_actions = true)
{
$fields = new FieldList();
//main info
$fields->push(new TextField('title', 'Title'));
$fields->push(new TextField('url', 'Url'));
$categoryField = new TextField('event_category', 'Category');
$categoryField->setAttribute('class', 'event-category-autocomplete text');
$fields->push($categoryField);
//location
$fields->push(new TextField('location', 'Location'));
//duration
$fields->push($start_date = new TextField('start_date', 'Start Date'));
$fields->push($end_date = new TextField('end_date', 'End Date'));
$start_date->addExtraClass('date');
$end_date->addExtraClass('date');
// Guard against automated spam registrations by optionally adding a field
// that is supposed to stay blank (and is hidden from most humans).
// The label and field name are intentionally common ("username"),
// as most spam bots won't resist filling it out. The actual username field
// on the forum is called "Nickname".
$fields->push(new TextField('user_name', 'UserName'));
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('saveEvent', 'Save'));
}
// Create validators
$validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('title', 'location'), new RequiredFields('start_date', 'end_date')));
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例3: 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;
}
示例4: TextField
function __construct($controller, $name)
{
$Name = new TextField('Name', 'Your name');
$Phone = new TextField('Phone', 'Your phone number');
$Email = new TextField('Email', 'Your email');
$Subject = new TextField('Subject', 'Subject');
$Message = new TextareaField('Message', 'Your message', '10', '45');
$Name->addExtraClass('Required');
$Email->addExtraClass('Required');
$Message->addExtraClass('Required');
$messageFields = new CompositeField($Name, $Phone, $Email, $Subject, $Message);
$fields = new FieldSet($messageFields);
$actions = new FieldSet(new FormAction('processMessage', 'send'));
Requirements::customScript('
jQuery(document).ready(function() {
jQuery("#ContactForm_ContactForm_Name").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
jQuery("#ContactForm_ContactForm_Email").addClass("validate[required,custom[email]] text-input");
jQuery("#ContactForm_ContactForm_Message").addClass("validate[required,length[6,300]] text-input");
jQuery("#ContactForm_ContactForm").validationEngine()
});
');
parent::__construct($controller, $name, $fields, $actions);
}
示例5: 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;
}
示例6: getHTMLFragments
/**
*
* @param GridField $gridField
* @return string - HTML
*/
public function getHTMLFragments($gridField)
{
$searchState = $gridField->State->GridFieldSearchRelation;
$dataClass = $gridField->getList()->dataClass();
$forTemplate = new ArrayData(array());
$forTemplate->Fields = new ArrayList();
$searchFields = $this->getSearchFields() ? $this->getSearchFields() : $this->scaffoldSearchFields($dataClass);
$value = $this->findSingleEntry($gridField, $searchFields, $searchState, $dataClass);
$searchField = new TextField('gridfield_relationsearch', _t('GridField.RelationSearch', "Relation search"), $value);
// Apparently the data-* needs to be double qouted for the jQuery.meta data plugin
$searchField->setAttribute('data-search-url', '\'' . Controller::join_links($gridField->Link('search') . '\''));
$searchField->setAttribute('placeholder', $this->getPlaceholderText($dataClass));
$searchField->addExtraClass('relation-search no-change-track');
$findAction = new GridField_FormAction($gridField, 'gridfield_relationfind', _t('GridField.Find', "Find"), 'find', 'find');
$findAction->setAttribute('data-icon', 'relationfind');
$addAction = new GridField_FormAction($gridField, 'gridfield_relationadd', _t('GridField.LinkExisting', "Link Existing"), 'addto', 'addto');
$addAction->setAttribute('data-icon', 'chain--plus');
// If an object is not found, disable the action
if (!is_int($gridField->State->GridFieldAddRelation)) {
$addAction->setReadonly(true);
}
$forTemplate->Fields->push($searchField);
$forTemplate->Fields->push($findAction);
$forTemplate->Fields->push($addAction);
return array($this->targetFragment => $forTemplate->renderWith($this->itemClass));
}
示例7: TextField
function __construct($controller, $name)
{
$org_field = null;
$current_user = Member::currentUser();
$current_affiliations = $current_user->getCurrentAffiliations();
if (!$current_affiliations) {
$org_field = new TextField('Organization', 'Your Organization Name');
} else {
if (count($current_affiliations) > 1) {
$source = array();
foreach ($current_affiliations as $a) {
$org = $a->Organization();
$source[$org->ID] = $org->Name;
}
$source['0'] = "-- New One --";
$ddl = new DropdownField('OrgID', 'Your Organization', $source);
$ddl->setEmptyString('-- Select Your Organization --');
$org_field = new FieldGroup();
$org_field->push($ddl);
$org_field->push($txt = new TextField('Organization', ''));
$txt->addExtraClass('new-org-name');
} else {
$org_field = new TextField('Organization', 'Your Organization Name', $current_user->getOrgName());
}
}
$fields = new FieldList($org_field, new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextareaField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $country = new DropdownField('PrimaryCountry', 'Country', CountryCodes::$iso_3166_countryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CustomCheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options)));
$org_it_activity->addExtraClass('hidden');
$country->setEmptyString('-- Select One --');
$nextButton = new FormAction('NextStep', ' Next Step ');
$actions = new FieldList($nextButton);
$validator = new RequiredFields();
Requirements::javascript('surveys/js/deployment_survey_yourorganization_form.js');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例8: FieldList
function __construct($controller, $name)
{
$fields = new FieldList(array($t1 = new TextField('ExternalOrderId', 'Eventbrite Order #'), $checkbox = new CheckboxField('SharedContactInfo', 'Allow to share contact info?')));
$t1->setAttribute('placeholder', 'Enter your Eventbrite order #');
$t1->addExtraClass('event-brite-order-number');
$attendees = Session::get('attendees');
if (count($attendees) > 0) {
$t1->setValue(Session::get('ExternalOrderId'));
$t1->setReadonly(true);
$checkbox->setValue(intval(Session::get('SharedContactInfo')) === 1);
$fields->add(new LiteralField('ctrl1', 'Current Order has following registered attendees, please select one:'));
$options = array();
foreach ($attendees as $attendee) {
$ticket_external_id = intval($attendee['ticket_class_id']);
$ticket_type = SummitTicketType::get()->filter('ExternalId', $ticket_external_id)->first();
if (is_null($ticket_type)) {
continue;
}
$options[$attendee['id']] = $attendee['profile']['name'] . ' (' . $ticket_type->Name . ')';
}
$attendees_ctrl = new OptionSetField('SelectedAttendee', '', $options);
$fields->add($attendees_ctrl);
$validator = new RequiredFields(array('ExternalOrderId'));
// Create action
$actions = new FieldList($btn_clear = new FormAction('clearSummitAttendeeInfo', 'Clear'), $btn = new FormAction('saveSummitAttendeeInfo', 'Done'));
$btn->addExtraClass('btn btn-default active');
$btn_clear->addExtraClass('btn btn-danger active');
} else {
$validator = new RequiredFields(array('ExternalOrderId'));
// Create action
$actions = new FieldList($btn = new FormAction('saveSummitAttendeeInfo', 'Get Order'));
$btn->addExtraClass('btn btn-default active');
}
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例9: FieldList
function __construct($controller, $name, $speakerID, $use_actions = true)
{
$fields = new FieldList();
//point of contact
$speakerIDfield = new HiddenField('speaker_id');
$speakerIDfield->setValue($speakerID);
$fields->push($speakerIDfield);
$fields->push(new TextField('org_name', 'Name of Organizer'));
$fields->push(new EmailField('org_email', 'Email'));
$fields->push(new TextField('event_name', 'Event'));
$fields->push(new TextField('event_format', 'Format/Length'));
$fields->push(new TextField('event_attendance', 'Expected Attendance (number)'));
$fields->push(new TextField('event_date', 'Date of Event'));
$fields->push(new TextField('event_location', 'Location'));
$fields->push(new TextField('event_topic', 'Topic(s)'));
$request = new HtmlEditorField('general_request', 'General Request');
$request->setRows(10);
$fields->push($request);
$sec_field = new TextField('field_98438688', 'field_98438688');
$sec_field->addExtraClass('honey');
$fields->push($sec_field);
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('sendSpeakerEmail', 'Send'));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例10: RegistrationForm
function RegistrationForm()
{
// Name Set
$FirstNameField = new TextField('FirstName', "First Name");
$LastNameField = new TextField('Surname', "Last Name");
// Email Addresses
$PrimaryEmailField = new TextField('Email', "Primary Email Address");
// New Gender Field
$GenderField = new OptionSetField('Gender', 'I identify my gender as:', array('Male' => 'Male', 'Female' => 'Female', 'Specify' => 'Let me specify', 'Prefer not to say' => 'Prefer not to say'));
$GenderSpecifyField = new TextField('GenderSpecify', 'Specify your gender');
$GenderSpecifyField->addExtraClass('hide');
$StatementOfInterestField = new TextField('StatementOfInterest', 'Statement of Interest');
$StatementOfInterestField->addExtraClass('autocompleteoff');
$affiliations = new AffiliationField('Affiliations', 'Affiliations');
$affiliations->setMode('local');
$fields = new FieldList($FirstNameField, $LastNameField, new LiteralField('break', '<hr/>'), $PrimaryEmailField, new LiteralField('instructions', '<p>This will also be your login name.</p>'), new LiteralField('break', '<hr/>'), $GenderField, $GenderSpecifyField, new LiteralField('instructions', '<p>It\'s perfectly acceptable if you choose not to tell us: we appreciate you becoming a member of OpenStack Foundation. The information will remain private and only used to monitor our effort to improve gender diversity in our community.</p>'), new LiteralField('break', '<hr/>'), $affiliations, $StatementOfInterestField, new LiteralField('instructions', '<p>Your statement of interest should be a few words describing your objectives or plans for OpenStack.</p>'), new LiteralField('break', '<hr/>'), new TextField('Address', _t('Addressable.ADDRESS', 'Street Address (Line1)')), new TextField('Suburb', _t('Addressable.SUBURB', 'Street Address (Line2)')), new TextField('City', _t('Addressable.CITY', 'City')));
$label = _t('Addressable.STATE', 'State');
if (is_array($this->allowedStates)) {
$fields->push(new DropdownField('State', $label, $this->allowedStates));
} elseif (!is_string($this->allowedStates)) {
$fields->push(new TextField('State', $label));
}
$AdressField = new TextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
$fields->push($AdressField);
$label = _t('Addressable.COUNTRY', 'Country');
if (is_array($this->allowedCountries)) {
$countryField = new DropdownField('Country', $label, $this->allowedCountries);
$countryField->addExtraClass('chzn-select');
$countryField->setEmptyString('-- Select One --');
$fields->push($countryField);
} elseif (!is_string($this->allowedCountries)) {
$countryField = new CountryDropdownField('Country', $label);
$countryField->setEmptyString('-- Select One --');
$countryField->addExtraClass('chzn-select');
$fields->push($countryField);
}
$fields->push(new LiteralField('break', '<hr/>'));
$fields->push(new ConfirmedPasswordField('Password', 'Password'));
$fields->push(new HiddenField('MembershipType', 'MembershipType', 'foundation'));
$request = Controller::curr()->getRequest();
$back_url = $request->getVar('BackURL');
if (!empty($back_url)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $back_url));
}
$actions = new FieldList(new FormAction('doRegister', 'Submit My Application'));
$validator = new Member_Validator('FirstName', 'Surname', 'Email', 'StatementOfInterest', 'Address', 'City', 'Country', 'Password');
$form = new HoneyPotForm($this, 'RegistrationForm', $fields, $actions, $validator);
if ($data = Session::get("FormInfo.{$form->FormName()}.data")) {
if (isset($data['HiddenAffiliations'])) {
$affiliations->setValue($data['HiddenAffiliations']);
}
return $form->loadDataFrom($data);
}
return $form;
}
示例11: FieldList
function __construct($controller, $name, $use_actions = true)
{
$fields = new FieldList();
//point of contact
$fields->push($point_of_contact_name = new TextField('point_of_contact_name', 'Name'));
$fields->push($point_of_contact_email = new EmailField('point_of_contact_email', 'Email'));
//main info
$fields->push($title = new TextField('title', 'Title'));
$fields->push($url = new TextField('url', 'Url'));
$fields->push(new CheckboxField('is_coa_needed', 'Is COA needed?'));
$fields->push($ddl_type = new DropdownField('job_type', 'Job Type', JobType::get()->sort("Type")->map("ID", "Type")));
$ddl_type->setEmptyString("--SELECT A JOB TYPE --");
$fields->push($description = new HtmlEditorField('description', 'Description'));
$fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
$fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
$fields->push($company = new CompanyField('company', 'Company'));
$point_of_contact_name->addExtraClass('job_control');
$point_of_contact_email->addExtraClass('job_control');
$title->addExtraClass('job_control');
$url->addExtraClass('job_control');
$description->addExtraClass('job_control');
$instructions->addExtraClass('job_control');
$expiration_date->addExtraClass('job_control');
$company->addExtraClass('job_control');
//location
$ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
$ddl_locations->addExtraClass('location_type');
$ddl_locations->addExtraClass('job_control');
$fields->push($ddl_locations);
$fields->push($city = new TextField('city', 'City'));
$fields->push($state = new TextField('state', 'State'));
$fields->push($country = new CountryDropdownField('country', 'Country'));
$city->addExtraClass('physical_location');
$state->addExtraClass('physical_location');
$country->addExtraClass('physical_location');
// Guard against automated spam registrations by optionally adding a field
// that is supposed to stay blank (and is hidden from most humans).
// The label and field name are intentionally common ("username"),
// as most spam bots won't resist filling it out. The actual username field
// on the forum is called "Nickname".
$fields->push(new TextField('user_name', 'UserName'));
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('saveJobRegistrationRequest', 'Save'));
}
// Create validators
$validator = new ConditionalAndValidationRule([new HtmlPurifierRequiredValidator('title', 'instructions', 'description'), new RequiredFields('job_type', 'point_of_contact_name', 'point_of_contact_email')]);
$this->addExtraClass('job-registration-form');
$this->addExtraClass('input-form');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例12: TextField
/**
* @param Controller $controller
* @param String $name
* @param FieldList $fields
* @param FieldList $actions
* @param null $validator
*/
function __construct($controller, $name, FieldList $fields, FieldList $actions, $validator = null)
{
// Guard against automated spam registrations by optionally adding a field
// that is supposed to stay blank (and is hidden from most humans).
$fields->push($honey = new TextField(self::FieldName, self::FieldName));
$honey->addExtraClass('honey');
$css = <<<CSS
.honey {
\tposition: absolute; left: -9999px
}
CSS;
Requirements::customCSS($css, 'honey_css');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例13: ExportForm
/**
* Builds the entry form so the user can choose what to export.
*/
function ExportForm()
{
$fields = new FieldList();
// Display available yml files so we can re-export easily.
$ymlDest = BASE_PATH . '/' . TestDataController::get_data_dir();
$existingFiles = scandir($ymlDest);
$ymlFiles = array();
foreach ($existingFiles as $file) {
if (preg_match("/.*\\.yml/", $file)) {
$ymlFiles[$file] = $file;
}
}
if ($ymlFiles) {
$fields->push(new DropdownField('Reexport', 'Reexport to file (will override any other setting): ', $ymlFiles, '', null, '-- choose file --'));
}
// Get the list of available DataObjects
$dataObjectNames = ClassInfo::subclassesFor('DataObject');
unset($dataObjectNames['DataObject']);
sort($dataObjectNames);
foreach ($dataObjectNames as $dataObjectName) {
// Skip test only classes.
$class = singleton($dataObjectName);
if ($class instanceof TestOnly) {
continue;
}
// Skip testdata internal class
if ($class instanceof TestDataTag) {
continue;
}
// Create a checkbox for including this object in the export file
$count = $class::get()->Count();
$fields->push($class = new CheckboxField("Class[{$dataObjectName}]", $dataObjectName . " ({$count})"));
$class->addExtraClass('class-field');
// Create an ID range selection input
$fields->push($range = new TextField("Range[{$dataObjectName}]", ''));
$range->addExtraClass('range-field');
}
// Create the "traverse relations" option - whether it should automatically include relation objects even if not explicitly ticked.
$fields->push(new CheckboxField('TraverseRelations', 'Traverse relations (implicitly includes objects, for example pulls Groups for Members): ', 1));
// Create the option to include real files.
$path = BASE_PATH . '/' . TestDataController::get_data_dir();
$fields->push(new CheckboxField('IncludeFiles', "Copy real files (into {$path}files)", 0));
// Create file name input field
$fields->push(new TextField('FileName', 'Name of the output YML file: ', 'output.yml'));
// Create actions for the form
$actions = new FieldList(new FormAction("export", "Export"));
$form = new Form($this, "ExportForm", $fields, $actions);
$form->setFormAction(Director::baseURL() . 'dev/data/export/TestDataExporter/ExportForm');
return $form;
}
示例14: 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;
}
示例15: 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;
}