本文整理汇总了PHP中CheckboxField::addExtraClass方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckboxField::addExtraClass方法的具体用法?PHP CheckboxField::addExtraClass怎么用?PHP CheckboxField::addExtraClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CheckboxField
的用法示例。
在下文中一共展示了CheckboxField::addExtraClass方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$categoryFields = array();
$nonCategoryFields = array();
$fields->addFieldToTab('Root.Main', new TextField('ContentTitle', 'Content Title'));
$fields->addFieldToTab('Root.Main', new DropdownField('ItemStyle', 'Item Style', self::$styles));
$fields->addFieldToTab('Root.Main', new DropdownField('DefaultLayout', 'Default Layout', $this->dbObject('DefaultLayout')->enumValues()));
$fields->addFieldToTab('Root.Main', new NumericField('LimitTopResults', 'Limit Top Results - how many items to show at top (defaults to 4)'));
$fields->addFieldToTab('Root.Main', new NumericField('LimitBottomResults', 'Limit Bottom Results - how many items to show at bottom (defaults to 30)'));
//children fields
$fields->addFieldsToTab('Root.Main', array($useChildren = new CheckboxField('UseChildren', 'Use page as category?', 1), $categoryFields[] = $pageField = new ContentModuleTreeDropdownField('TopLevelPageID', 'Top Level Page', 'SiteTree'), $categoryFields[] = $showSearch = new CheckboxField('ShowSearch', 'Show search?'), $categoryFields[] = $hasCategories = new CheckBoxField('HasCategories', 'Has categories? (2 levels or single level)'), $categoryFields[] = $showCategories = new CheckboxField('ShowCategories', 'Show category navigation bar? (for filtering)')));
$pageField->addExtraClass('use-children');
$useChildren->addExtraClass('use-children');
$showSearch->addExtraClass('show-search');
$hasCategories->addExtraClass('has-categories');
$showCategories->addExtraClass('show-categories');
//add page fields
$fields->addFieldsToTab('Root.Main', array($tree = new ContentModuleTreeDropdownField('NewPage', 'Add Page (choose from dropdown to add below)', 'SiteTree'), $enableSeeMore = new CheckboxField('DisableSeeMore', 'Disable "See more"?', 0), $nonCategoryFields[] = $rEditor = new ContentModuleRelationshipEditor('PagesRelationEditor', 'Pages', 'Pages', $this, array('Title' => 'Title', 'Parent.Title' => 'Parent'))));
$rEditor->setSortField('SortOrder')->setShowDeleteButton(false);
//url for adding page
$tree->setAttribute('data-add_url', 'addPage');
$nonCategoryFields[] = $tree;
//setup classes for hiding show fields
foreach ($categoryFields as $categoryField) {
$categoryField->addExtraClass('category');
}
//setup classes for hiding show fields
foreach ($nonCategoryFields as $categoryField) {
$categoryField->addExtraClass('non-category');
}
Requirements::javascript(INPAGE_MODULES_DIR . '/javascript/RelatedPagesModuleCMS.js');
return $fields;
}
示例2: 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;
}
示例3: 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;
}
示例4: HiddenField
function __construct($controller, $name, $article = null, bool $is_manager, $use_actions = true)
{
$IDField = new HiddenField('newsID');
//madatory fields
$HeadlineField = new TextField('headline', 'Headline (150 character max)', '', $maxLength = 150);
$HeadlineField->addExtraClass('headline');
$SummaryField = new HtmlEditorField('summary', 'Summary (300 character max)');
$SummaryField->addExtraClass('summary');
$SummaryField->setAttribute('max_chars', 300);
$CityField = new TextField('city', 'City');
$StateField = new TextField('state', 'State');
$CountryField = new CountryDropdownField('country', 'Country');
$TagsField = new TextField('tags', 'Tags');
$DateEmbargoField = new TextField('date_embargo', 'Desired release date/time: Time zone is Central Time. Please ensure your release date is in Central Time
(<a target="_blank" href="http://www.timeanddate.com/worldclock/converter.html">time converter</a>)');
$DateEmbargoField->addExtraClass('datefield');
if ($is_manager) {
$DateExpireField = new TextField('date_expire', 'Expire Date');
$DateExpireField->addExtraClass('datefield');
}
$UpdatedField = new DatetimeField_Readonly('date_updated', 'Last Updated');
//$UpdatedField->addExtraClass('inline');
//optional fields
$BodyField = new HtmlEditorField('body', 'Body');
$LinkField = new TextField('link', 'Link');
$DocumentField = new CustomUploadField('Document', 'Document');
$DocumentField->addExtraClass('hidden');
$DocumentField->setCanAttachExisting(false);
$DocumentField->setAllowedMaxFileNumber(1);
$DocumentField->setAllowedFileCategories('doc');
$DocumentField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
$DocumentField->setFolderName('news-documents');
$sizeMB = 1;
// 1 MB
$size = $sizeMB * 1024 * 1024;
// 1 MB in bytes
$DocumentField->getValidator()->setAllowedMaxFileSize($size);
$DocumentField->setCanPreviewFolder(false);
// Don't show target filesystem folder on upload field
$DocumentField->setRecordClass('File');
$ImageField = new CustomUploadField('Image', 'Image (Max size 2Mb - Suggested size 300x250px)');
$ImageField->setCanAttachExisting(false);
$ImageField->setAllowedMaxFileNumber(1);
$ImageField->setAllowedFileCategories('image');
$ImageField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
$ImageField->setFolderName('news-images');
$ImageField->setRecordClass('BetterImage');
$ImageField->getUpload()->setReplaceFile(false);
$ImageField->setOverwriteWarning(false);
$sizeMB = 2;
// 2 MB
$size = $sizeMB * 1024 * 1024;
// 2 MB in bytes
$ImageField->getValidator()->setAllowedMaxFileSize($size);
$ImageField->setCanPreviewFolder(false);
// Don't show target filesystem folder on upload field
if ($is_manager) {
$IsLandscapeField = new CheckboxField('is_landscape', 'Is Banner? (landscape image)');
$IsLandscapeField->addExtraClass('is_landscape');
}
if ($article) {
$IDField->setValue($article->ID);
$HeadlineField->setValue($article->Headline);
$SummaryField->setValue($article->Summary);
$CityField->setValue($article->City);
$StateField->setValue($article->State);
$CountryField->setValue($article->Country);
$TagsField->setValue($article->getTagsCSV());
if ($article->DateEmbargo) {
$DateEmbargoField->setValue(date('m/d/Y g:i a', strtotime($article->DateEmbargo)));
} else {
$DateEmbargoField->setValue(gmdate('m/d/Y g:i a'));
}
$UpdatedField->setValue($article->LastEdited);
$BodyField->setValue($article->Body);
$LinkField->setValue($article->Link);
if ($article->DateExpire) {
$DateExpireField->setValue(date('m/d/Y g:i a', strtotime($article->DateExpire)));
}
$IsLandscapeField->setValue($article->IsLandscape);
//submitter read only
$SubmitterFirstNameField = new ReadonlyField('submitter_first_name', 'First Name');
$SubmitterLastNameField = new ReadonlyField('submitter_last_name', 'Last Name');
$SubmitterEmailField = new ReadonlyField('submitter_email', 'Email');
$SubmitterCompanyField = new ReadonlyField('submitter_company', 'Company');
$SubmitterPhoneField = new ReadonlyField('submitter_phone', 'Phone');
$SubmitterFirstNameField->setValue($article->getSubmitter()->FirstName);
$SubmitterLastNameField->setValue($article->getSubmitter()->LastName);
$SubmitterEmailField->setValue($article->getSubmitter()->Email);
$SubmitterCompanyField->setValue($article->getSubmitter()->Company);
$SubmitterPhoneField->setValue($article->getSubmitter()->Phone);
} else {
// submitter fields
$SubmitterFirstNameField = new TextField('submitter_first_name', 'First Name');
$SubmitterLastNameField = new TextField('submitter_last_name', 'Last Name');
$SubmitterEmailField = new TextField('submitter_email', 'Email');
$SubmitterCompanyField = new TextField('submitter_company', 'Company');
$SubmitterPhoneField = new TextField('submitter_phone', 'Phone');
$LinkField->setValue('http://');
}
//.........这里部分代码省略.........
示例5: addShippingAddressFields
/**
* Add fields for shipping address and required fields to the validator.
*
* @param Array $fields Array of fields
* @param OrderFormValidator $validator Checkout form validator
*/
private function addShippingAddressFields(&$fields, &$validator)
{
$firstNameField = new TextField('Shipping[FirstName]', _t('CheckoutPage.FIRSTNAME', "First Name"));
$firstNameField->addExtraClass('shipping-firstname');
$firstNameField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_FIRSTNAME', "Please enter a first name."));
$surnameField = new TextField('Shipping[Surname]', _t('CheckoutPage.SURNAME', "Surname"));
$surnameField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_SURNAME', "Please enter a surname."));
$addressField = new TextField('Shipping[Address]', _t('CheckoutPage.ADDRESS1', "Address 1"));
$addressField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_ADDRESS', "Please enter an address."));
$cityField = new TextField('Shipping[City]', _t('CheckoutPage.CITY', "City"));
$cityField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_CITY', "Please enter a city."));
$countryField = new DropdownField('Shipping[Country]', _t('CheckoutPage.COUNTRY', "Country"), Country::shipping_countries());
$countryField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_COUNTRY', "Please enter a country."));
if (!Member::currentUserID() && Geoip::$default_country_code) {
$countryField->setValue(Geoip::$default_country_code);
}
$regions = Region::shipping_regions();
$regionField = null;
if (!empty($regions)) {
$regionField = new RegionField('Shipping[Region]', _t('CheckoutPage.REGION', "Region"));
$regionField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_REGION', "Please enter a country."));
}
$sameAddressField = new CheckboxField('ShipToBillingAddress', _t('CheckoutPage.SAME_ADDRESS', "to same address?"));
$sameAddressField->addExtraClass('shipping-same-address');
$shippingAddressFields = new CompositeField(new HeaderField(_t('CheckoutPage.SHIPPING_ADDRESS', "Shipping Address"), 3), $sameAddressField, $firstNameField, $surnameField, new TextField('Shipping[Company]', _t('CheckoutPage.COMPANY', "Company")), $addressField, new TextField('Shipping[AddressLine2]', _t('CheckoutPage.ADDRESS2', "Address 2")), $cityField, new TextField('Shipping[PostalCode]', _t('CheckoutPage.POSTAL_CODE', "Postal Code")), new TextField('Shipping[State]', _t('CheckoutPage.STATE', "State")), $countryField);
if ($regionField) {
$shippingAddressFields->push($regionField);
}
$shippingAddressFields->setID('ShippingAddress');
$fields['ShippingAddress'][] = $shippingAddressFields;
$validator->addRequiredField('Shipping[FirstName]');
$validator->addRequiredField('Shipping[Surname]');
$validator->addRequiredField('Shipping[Address]');
$validator->addRequiredField('Shipping[City]');
$validator->addRequiredField('Shipping[Country]');
}
示例6: AddTrainingCourseForm
function AddTrainingCourseForm()
{
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript("datepicker/javascript/datepicker.js");
Requirements::javascript('registration/javascript/edit.profile.training.form.js');
// Name Set
$Name = new TextField('Name', "Name");
$Name->addExtraClass('course-name');
$Link = new TextField('Link', "Link");
$Link->addExtraClass('course-online-link url');
$Description = new TextareaField('Description', "Description");
$Description->addExtraClass('course-description');
$Online = new CheckboxField('Online', "Is Online?");
$Online->addExtraClass('course-online-checkbox');
$Paid = new CheckboxField('Paid', "Is Paid?");
$Level = new DropdownField('LevelID', 'Level', TrainingCourseLevel::get()->map('ID', 'Level'));
$Projects = new CheckboxSetField('Projects', '', Project::get()->map('ID', 'Name'));
$Program = new HiddenField('TrainingServiceID', "TrainingServiceID", $this->training_id);
$Course = new HiddenField('ID', "course", 0);
$show_blank_schedule = true;
if (isset($this->EditCourseID)) {
$locations_dto = $this->course_repository->getLocations($this->EditCourseID);
for ($i = 0; $i < count($locations_dto); $i++) {
$dto = $locations_dto[$i];
$show_blank_schedule = false;
$City[$i] = new TextField('City[' . $i . ']', "City", $dto->getCity());
$City[$i]->addExtraClass('city_name');
$State[$i] = new TextField('State[' . $i . ']', "State", $dto->getState());
$State[$i]->addExtraClass('state');
$Country[$i] = new DropdownField('Country[' . $i . ']', $dto->getCountry(), CountryCodes::$iso_3166_countryCodes, $dto->getCountry());
$Country[$i]->setEmptyString('-- Select One --');
$Country[$i]->addExtraClass('country');
$LinkS[$i] = new TextField('LinkS[' . $i . ']', "Link", $dto->getLink());
$LinkS[$i]->addExtraClass('url');
$StartDate[$i] = new TextField('StartDate[' . $i . ']', "Start Date", is_null($dto->getStartDate()) ? '' : $dto->getStartDate());
$StartDate[$i]->addExtraClass('dateSelector start');
$EndDate[$i] = new TextField('EndDate[' . $i . ']', "End Date", is_null($dto->getEndDate()) ? '' : $dto->getEndDate());
$EndDate[$i]->addExtraClass('dateSelector end');
}
}
if ($show_blank_schedule) {
$City = new TextField('City[]', "City");
$City->addExtraClass('city_name');
$State = new TextField('State[]', "State");
$State->addExtraClass('state');
$Country = new DropdownField('Country[]', 'Country', CountryCodes::$iso_3166_countryCodes);
$Country->setEmptyString('-- Select One --');
$Country->addExtraClass('country');
$StartDate = new TextField('StartDate[]', "Start Date");
$StartDate->addExtraClass('dateSelector start');
$EndDate = new TextField('EndDate[]', "End Date");
$EndDate->addExtraClass('dateSelector end');
$LinkS = new TextField('LinkS[]', "Link");
$LinkS->addExtraClass('url');
}
$fields = new FieldList($Name, $Description, $Link, new LiteralField('break', '<hr/><div class="horizontal-fields">'), $Online, $Paid, $Level, $Program, $Course, new LiteralField('break', '</div><hr/>'), new LiteralField('projects', '<h4>Projects</h4>'), $Projects, new LiteralField('schedule', '<h4>Schedule</h4>'), new LiteralField('instruction', '<p class="note_online">City, State and Country can\'t be edited when a course is marked <em>Online</em>.</p>'), new LiteralField('scheduleDiv', '<div id="schedules">'));
if (!$show_blank_schedule) {
for ($j = 0; $j < $i; $j++) {
$fields->push(new LiteralField('scheduleDiv', '<div class="scheduleRow">'));
$fields->push($City[$j]);
$fields->push($State[$j]);
$fields->push($Country[$j]);
$fields->push($StartDate[$j]);
$fields->push($EndDate[$j]);
$fields->push($LinkS[$j]);
$fields->push(new LiteralField('scheduleDiv', '</div>'));
}
} else {
$fields->push(new LiteralField('scheduleDiv', '<div class="scheduleRow">'));
$fields->push($City);
$fields->push($State);
$fields->push($Country);
$fields->push($StartDate);
$fields->push($EndDate);
$fields->push($LinkS);
$fields->push(new LiteralField('scheduleDiv', '</div>'));
}
$fields->push(new LiteralField('scheduleDivC', '</div>'));
$fields->push(new LiteralField('addSchedule', '<button id="addSchedule" class="action">Add Another</button>'));
$actions = new FieldList(new FormAction('AddCourse', 'Submit'));
$validators = new ConditionalAndValidationRule(array(new RequiredFields('Name', 'Level'), new HtmlPurifierRequiredValidator('Description')));
$form = new Form($this, 'AddTrainingCourseForm', $fields, $actions, $validators);
if (isset($this->EditCourseID)) {
$form->loadDataFrom($this->course_repository->getById($this->EditCourseID));
unset($this->EditCourseID);
} else {
$form->loadDataFrom($this->request->postVars());
}
return $form;
}
示例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;
}