当前位置: 首页>>代码示例>>PHP>>正文


PHP DropdownField::addExtraClass方法代码示例

本文整理汇总了PHP中DropdownField::addExtraClass方法的典型用法代码示例。如果您正苦于以下问题:PHP DropdownField::addExtraClass方法的具体用法?PHP DropdownField::addExtraClass怎么用?PHP DropdownField::addExtraClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DropdownField的用法示例。


在下文中一共展示了DropdownField::addExtraClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getHTMLFragments

 public function getHTMLFragments($gridField)
 {
     $this->gridField = $gridField;
     Requirements::javascript('summit/javascript/GridFieldBulkAction.js');
     Requirements::css('summit/css/GridFieldBulkAction.css');
     $field = new DropdownField(sprintf('%s[EntityID]', __CLASS__), '', $this->getEntities());
     $field->setEmptyString("-- select --");
     $field->addExtraClass('no-change-track');
     $field->addExtraClass('select-entity');
     $data = new ArrayData(array('Title' => $this->title, 'Link' => Controller::join_links($gridField->Link(), 'assignBulkAction', '{entityID}'), 'ClassField' => $field, 'Colspan' => count($gridField->getColumns()) - 1));
     return array($this->targetFragment => $data->renderWith(__CLASS__));
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:12,代码来源:GridFieldBulkAction.php

示例2: 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);
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:52,代码来源:JobRegistrationRequestForm.php

示例3: getHTMLFragments

 public function getHTMLFragments($gridField)
 {
     $this->gridField = $gridField;
     Requirements::javascript('summit/javascript/GridFieldWipeDevicesDataAction.js');
     Requirements::css('summit/css/GridFieldWipeDevicesDataAction.css');
     $actions = array();
     $actions['wipe-all'] = 'Wipe all devices';
     $actions['wipe-user'] = 'Wipe user device';
     $field = new DropdownField(sprintf('%s[ActionID]', __CLASS__), '', $actions);
     $field->setEmptyString("-- select --");
     $field->addExtraClass('no-change-track');
     $field->addExtraClass('select-wipe-action');
     $data = new ArrayData(array('Title' => "Create Wipe Data Device Event", 'Link' => Controller::join_links($gridField->Link(), 'wipeDevicesDataAction', '{ActionID}'), 'LinkAutocomple' => Controller::join_links($gridField->Link(), 'wipeDevicesGetAttendeesAction'), 'ClassField' => $field));
     return array($this->targetFragment => $data->renderWith(__CLASS__));
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:15,代码来源:GridFieldWipeDevicesDataAction.php

示例4: testAddExtraClass

	function testAddExtraClass() {
		/* DropdownField has an extra class name and is in the HTML the field returns */
		$dropdownField = new DropdownField('FeelingOk', 'Are you feeling ok?', array(0 => 'No', 1 => 'Yes'), '', null, '(Select one)');
		$dropdownField->addExtraClass('thisIsMyExtraClassForDropdownField');
		preg_match('/thisIsMyExtraClassForDropdownField/', $dropdownField->Field(), $matches);
		$this->assertTrue($matches[0] == 'thisIsMyExtraClassForDropdownField');
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:7,代码来源:DropdownFieldTest.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : Summit::ActiveSummitID();
     Requirements::javascript('summit/javascript/SummitPushNotification.js');
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', $txt = new TextareaField('Message', 'Message'));
     $txt->setAttribute('required', 'true');
     $f->addFieldToTab('Root.Main', $ddl_channel = new DropdownField('Channel', 'Channel', singleton('SummitPushNotification')->dbObject('Channel')->enumValues()));
     $f->addFieldToTab('Root.Main', $ddl_events = new DropdownField('EventID', 'Event', SummitEvent::get()->filter(['Published' => 1, 'SummitID' => $summit_id])->sort('Title', 'ASC')->Map('ID', 'FormattedTitle')));
     $f->addFieldToTab('Root.Main', $ddl_groups = new DropdownField('GroupID', 'Group', Group::get()->sort('Title', 'ASC')->Map('ID', 'Title')));
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     $ddl_channel->setEmptyString('--SELECT A CHANNEL--');
     $ddl_channel->setAttribute('required', 'true');
     $ddl_events->setEmptyString('--SELECT AN EVENT--');
     $ddl_events->addExtraClass('hidden');
     $ddl_groups->setEmptyString('--SELECT A GROUP--');
     $ddl_groups->addExtraClass('hidden');
     $config = GridFieldConfig_RelationEditor::create(50);
     $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $config->removeComponentsByType('GridFieldAddNewButton');
     $config->addComponent($auto_completer = new CustomGridFieldAddExistingAutocompleter('buttons-before-right'));
     $auto_completer->setResultsFormat('$Title ($Email)');
     $recipients = new GridField('Recipients', 'Member Recipients', $this->Recipients(), $config);
     $f->addFieldToTab('Root.Main', $recipients);
     return $f;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:26,代码来源:SummitPushNotification.php

示例6: updateCMSFields

 /**
  * Add subsites-specific fields to the folder editor.
  */
 public function updateCMSFields(FieldList $fields)
 {
     $ctrl = null;
     if (Controller::has_curr()) {
         $ctrl = Controller::curr();
     }
     if (!$ctrl) {
         return;
     }
     // This fixes fields showing up for no reason in the list view (not moved to Details tab)
     if ($ctrl->getAction() !== 'EditForm') {
         return;
     }
     if ($this->owner instanceof Folder) {
         // Allow to move folders from one site to another
         $sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
         $values = array();
         $values[0] = _t('FileSubsites.AllSitesDropdownOpt', 'All sites');
         foreach ($sites as $site) {
             $values[$site->ID] = $site->Title;
         }
         ksort($values);
         if ($sites) {
             //Dropdown needed to move folders between subsites
             $dropdown = new DropdownField('SubsiteID', _t('FileSubsites.SubsiteFieldLabel', 'Subsite'), $values);
             $dropdown->addExtraClass('subsites-move-dropdown');
             $fields->push($dropdown);
         }
         // On main site, allow showing this folder in subsite
         if ($this->owner->SubsiteID == 0 && !Subsite::currentSubsiteID()) {
             $fields->push(new CheckboxField('ShowInSubsites', _t('SubsiteFileExtension.ShowInSubsites', 'Show in subsites')));
         }
     }
 }
开发者ID:lekoala,项目名称:silverstripe-subsites-extras,代码行数:37,代码来源:SubsiteFileExtension.php

示例7: InviteForm

 /**
  * @return Form
  */
 public function InviteForm()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js');
     Requirements::javascript('eventmanagement/javascript/EventInvitationField_invite.js');
     if ($times = $this->form->getRecord()->DateTimes()) {
         $times = $times->map('ID', 'Summary');
     } else {
         $times = array();
     }
     // Get past date times attached to the parent calendar, so we can get
     // all registered members from them.
     $past = DataObject::get('RegisterableDateTime', sprintf('"CalendarID" = %d AND "StartDate" < \'%s\'', $this->form->getRecord()->CalendarID, date('Y-m-d')));
     if ($past) {
         $pastTimes = array();
         foreach ($past->groupBy('EventID') as $value) {
             $pastTimes[$value->First()->EventTitle()] = $value->map('ID', 'Summary');
         }
     } else {
         $pastTimes = array();
     }
     $fields = new Tab('Main', new HeaderField('Select A Date/Time To Invite To'), new DropdownField('TimeID', '', $times, null, null, true), new HeaderField('AddPeopleHeader', 'Add People To Invite From'), new SelectionGroup('AddPeople', array('From a member group' => $group = new DropdownField('GroupID', '', DataObject::get('Group')->map(), null, null, true), 'From a past event' => $time = new GroupedDropdownField('PastTimeID', '', $pastTimes, null, null, true))), new HeaderField('EmailsToSendHeader', 'People To Send Invite To'), $emails = new TableField('Emails', 'EventInvitation', array('Name' => 'Name', 'Email' => 'Email Address'), array('Name' => 'TextField', 'Email' => 'TextField')));
     $group->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromgroup')));
     $time->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromtime')));
     $emails->setCustomSourceItems(new DataObjectSet());
     $fields = new FieldSet(new TabSet('Root', $fields));
     $validator = new RequiredFields('TimeID');
     return new Form($this, 'InviteForm', $fields, new FieldSet(new FormAction('doInvite', 'Invite')), $validator);
 }
开发者ID:nyeholt,项目名称:silverstripe-eventmanagement,代码行数:33,代码来源:EventInvitationField.php

示例8: FieldList

 function __construct($controller, $name, $use_actions = true)
 {
     $fields = new FieldList();
     //main info
     $fields->push($title = new TextField('title', 'Title'));
     $fields->push($url = new TextField('url', 'Url'));
     $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 TextField('company_name', 'Company'));
     $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('saveJob', 'Save'));
     }
     // Create validators
     $validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('title', 'company_name', 'instructions', 'description')));
     $this->addExtraClass('job-registration-form');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:43,代码来源:JobForm.php

示例9: getHTMLFragments

 /**
  * Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
  *
  * Here are 4 built-in fragments: 'header', 'footer', 'before', and 'after', but components may also specify
  * fragments of their own.
  *
  * To specify a new fragment, specify a new fragment by including the text "$DefineFragment(fragmentname)" in the
  * HTML that you return.  Fragment names should only contain alphanumerics, -, and _.
  *
  * If you attempt to return HTML for a fragment that doesn't exist, an exception will be thrown when the GridField
  * is rendered.
  *
  * @return Array
  */
 public function getHTMLFragments($gridField)
 {
     $forTemplate = new ArrayData(array());
     $forTemplate->Fields = new ArrayList();
     $stageTitle = _t('PublishableGridFieldAction.STAGE', 'Stage');
     $stages = array('Latest' => _t('PublishableGridFieldAction.LATEST_VERSION', 'All'), 'All' => _t('PublishableGridFieldAction.LATEST_VERSION', 'All (Including Deleted)'), 'Live' => _t('PublishableGridFieldAction.STAGE_LIVE', 'Published'), 'Stage' => _t('PublishableGridFieldAction.STAGE_STAGE', 'Draft'));
     $currentStage = $gridField->State->PublishableGridField->currentStage;
     $stageDropdownField = new DropdownField('PublishableStage', $stageTitle, $stages, $currentStage);
     $stageDropdownField->addExtraClass('no-change-track');
     $forTemplate->Fields->push($stageDropdownField);
     return array($this->targetFragment => $forTemplate->renderWith($this->itemClass));
 }
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-publishable,代码行数:26,代码来源:PublishableGridFieldStageFilter.php

示例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'));
     $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;
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:50,代码来源:RegistrationPage.php

示例11: 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;
    }
开发者ID:helpfulrobot,项目名称:adrexia-processmap,代码行数:49,代码来源:ProcessStage.php

示例12: updateDateTimeCMSFields

 public function updateDateTimeCMSFields($fields)
 {
     if (!($locations = DataObject::get('EventLocation'))) {
         return;
     }
     $capacities = array();
     foreach ($locations as $location) {
         if ($location->Capacity) {
             $capacities[$location->ID] = (int) $location->Capacity;
         }
     }
     $dropdown = new DropdownField('LocationID', _t('EventLocations.LOCATION', 'Location'), $locations->map('ID', 'Title'), null, null, true);
     $dropdown->addExtraClass('{ capacities: ' . Convert::array2json($capacities) . ' }');
     $fields->addFieldToTab('Root.Main', $dropdown, 'StartDate');
 }
开发者ID:nyeholt,项目名称:silverstripe-eventlocations,代码行数:15,代码来源:LocationDateTimeExtension.php

示例13: getHTMLFragments

 public function getHTMLFragments($grid)
 {
     $classes = $this->getClasses($grid);
     if (!count($classes)) {
         return array();
     }
     GridFieldExtensions::include_requirements();
     $field = new DropdownField(sprintf('%s[ClassName]', __CLASS__), '', $classes, $this->defaultClass);
     $field->setAttribute('id', uniqid());
     if (Config::inst()->get('GridFieldAddNewMultiClass', 'showEmptyString')) {
         $field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
     }
     $field->addExtraClass('no-change-track');
     $data = new ArrayData(array('Title' => $this->getTitle(), 'Link' => Controller::join_links($grid->Link(), 'add-multi-class', '{class}'), 'ClassField' => $field));
     return array($this->getFragment() => $data->renderWith('GridFieldAddNewMultiClass'));
 }
开发者ID:salted-herring,项目名称:silverstripe-block,代码行数:16,代码来源:MultiClassSelector.php

示例14: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Features", $grid = GridField::create("Features", "Features", $this->owner->Features(), GridFieldConfig_RecordEditor::create()));
     $grid->getConfig()->removeComponentsByType('GridFieldDataColumns')->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldAddNewInlineButton())->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldOrderableRows());
     $grid->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('FeatureID' => function ($record, $column, $grid) {
         $dropdown = new DropdownField($column, 'Feature', Feature::get()->map('ID', 'Title')->toArray());
         $dropdown->addExtraClass('on_feature_select_fetch_value_field');
         return $dropdown;
     }, 'Value' => function ($record, $column, $grid) {
         if ($record->FeatureID) {
             $field = $record->Feature()->getValueField();
             $field->setName($column);
             return $field;
         }
         return new HiddenField($column);
     }));
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-comparison,代码行数:17,代码来源:ProductFeaturesExtension.php

示例15: updateCMSFields

 /**
  * Add subsites-specific fields to the folder editor.
  */
 function updateCMSFields(FieldList $fields)
 {
     if ($this->owner instanceof Folder) {
         $sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
         $values = array();
         $values[0] = _t('FileSubsites.AllSitesDropdownOpt', 'All sites');
         foreach ($sites as $site) {
             $values[$site->ID] = $site->Title;
         }
         ksort($values);
         if ($sites) {
             //Dropdown needed to move folders between subsites
             $dropdown = new DropdownField('SubsiteID', _t('FileSubsites.SubsiteFieldLabel', 'Subsite'), $values);
             $dropdown->addExtraClass('subsites-move-dropdown');
             $fields->push($dropdown);
             $fields->push(new LiteralField('Message', '<p class="message notice">' . _t('ASSETADMIN.SUBSITENOTICE', 'Folders and files created in the main site are accessible by all subsites.') . '</p>'));
         }
     }
 }
开发者ID:helpfulrobot,项目名称:mikenz-silverstripe-simplesubsites,代码行数:22,代码来源:FileSubsites.php


注:本文中的DropdownField::addExtraClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。