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


PHP TextareaField::setAttribute方法代码示例

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


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

示例1: EditProfileForm

 /**
  * @return Form|SS_HTTPResponse
  */
 public function EditProfileForm()
 {
     if (!Member::currentUser()) {
         $this->setFlash(_t('EditProfilePage.LoginWarning', 'Please login to edit your profile'), 'warning');
         return $this->redirect(Director::absoluteBaseURL());
     }
     $firstName = new TextField('FirstName');
     $firstName->setAttribute('placeholder', _t('EditProfilePage.FirstNamePlaceholder', 'Enter your first name'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $surname = new TextField('Surname');
     $surname->setAttribute('placeholder', _t('EditProfilePage.SurnamePlaceholder', 'Enter your surname'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $email = new EmailField('Email');
     $email->setAttribute('placeholder', _t('EditProfilePage.EmailPlaceholder', 'Enter your email address'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $jobTitle = new TextField('JobTitle');
     $jobTitle->setAttribute('placeholder', _t('EditProfilePage.JobTitlePlaceholder', 'Enter your job title'))->addExtraClass('form-control');
     $website = new TextField('Website');
     $website->setAttribute('placeholder', _t('EditProfilePage.WebsitePlaceholder', 'Enter your website'))->addExtraClass('form-control');
     $blurb = new TextareaField('Blurb');
     $blurb->setAttribute('placeholder', _t('EditProfilePage.BlurbPlaceholder', 'Enter your blurb'))->addExtraClass('form-control');
     $confirmPassword = new ConfirmedPasswordField('Password', _t('EditProfilePage.PasswordLabel', 'New Password'));
     $confirmPassword->canBeEmpty = true;
     $confirmPassword->setAttribute('placeholder', _t('EditProfilePage.PasswordPlaceholder', 'Enter your password'))->addExtraClass('form-control');
     $fields = new FieldList($firstName, $surname, $email, $jobTitle, $website, $blurb, $confirmPassword);
     $action = new FormAction('SaveProfile', _t('EditProfilePage.SaveProfileText', 'Update Profile'));
     $action->addExtraClass('btn btn-primary btn-lg');
     $actions = new FieldList($action);
     // Create action
     $validator = new RequiredFields('FirstName', 'Email');
     //Create form
     $form = new Form($this, 'EditProfileForm', $fields, $actions, $validator);
     //Populate the form with the current members data
     $Member = Member::currentUser();
     $form->loadDataFrom($Member->data());
     //Return the form
     return $form;
 }
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:38,代码来源:EditProfilePage.php

示例2: 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

示例3: getCMSFields

 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $dateTimeField = new DatetimeField('Date', $this->fieldLabel('Date')), 'Content');
     $dateTimeField->getDateField()->setConfig('showcalendar', true);
     $fields->addfieldToTab('Root.Main', $abstractField = new TextareaField('Abstract', $this->fieldLabel('Abstract')), 'Content');
     $abstractField->setAttribute('maxlength', '160');
     $abstractField->setRightTitle(_t('DateUpdatePage.AbstractDesc', 'The abstract is used as a summary on the listing pages. It is limited to 160 characters.'));
     $abstractField->setRows(6);
     return $fields;
 }
开发者ID:silverstripe-scienceninjas,项目名称:datedupdates,代码行数:14,代码来源:DatedUpdatePage.php

示例4: build

 /**
  * @param IRSVP $rsvp
  * @param IRSVPQuestionTemplate $question
  * @param IRSVPAnswer $answer
  * @return FormField
  */
 public function build(IRSVP $rsvp, IRSVPQuestionTemplate $question, IRSVPAnswer $answer)
 {
     $field = new TextareaField($question->name(), $question->label());
     $field->setValue($question->initialValue());
     $field->setColumns(50);
     if ($question->isReadOnly()) {
         $field->setDisabled(true);
     }
     if ($question->isMandatory()) {
         $field->setAttribute('data-rule-required', 'true');
     }
     if (!is_null($answer)) {
         $field->setValue($answer->value());
     }
     return $this->buildDependantRules($rsvp, $question, $field);
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:22,代码来源:RSVPTextAreaQuestionTemplateUIBuilder.php

示例5: ContactUsForm

 function ContactUsForm()
 {
     $name = null;
     $email = null;
     $member = Member::currentUser();
     if ($member) {
         $name = $member->Name;
         $email = $member->Email;
     }
     $fields = new FieldList(new TextField('Name', 'Name<span>(*)</span>', $name), new TextField('Email', 'Email<span>(*)</span>', $email), new TextField('Phone', 'Phone'), new TextField('Topic', 'Subject<span>(*)</span>'), $message = new TextareaField('Message', 'Message<span>(*)</span>'), new LiteralField('MessageLimit', '<span style="font-size:9px;margin-left:143px;position:relative;top:-15px;">Enter not more than 500 characters.</span>'), new RecaptchaField('MyCaptcha'));
     $message->setAttribute('maxlength', '500');
     // Create action
     $actions = new FieldList($submit = new FormAction('doContact', ''));
     $submit->setAttribute('src', 'themes/attwiz/images/button_send.gif');
     // Create action
     $validator = new RequiredFields('Name', 'Email', 'Topic', 'Message');
     $validator = null;
     return new Form($this, 'ContactUsForm', $fields, $actions, $validator);
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:19,代码来源:ContactUs.php

示例6: ContactForm

 function ContactForm()
 {
     // Set up the fields
     $nameField = new TextField('Name', 'Name');
     $nameField->setAttribute('placeholder', 'Name');
     $emailField = new EmailField('Email', 'Email');
     $emailField->setAttribute('placeholder', 'Email');
     $messageField = new TextareaField('Message', 'Message');
     $messageField->setAttribute('placeholder', 'Message');
     // Add the fields
     $fields = new FieldList($nameField, $emailField, $messageField);
     // Create action
     $actions = new FieldList(new FormAction('SendContactForm', 'Send Message'));
     // Create Validators
     $validator = new RequiredFields('Name', 'Email', 'Message');
     // Set up the form
     $form = new Form($this, 'ContactForm', $fields, $actions, $validator);
     $form->setTemplate('ContactForm');
     return $form;
 }
开发者ID:pmachapman,项目名称:rcpn.org.nz,代码行数:20,代码来源:ContactPage.php

示例7: ContactForm

 /**
  * @return static
  */
 public function ContactForm()
 {
     /* -----------------------------------------
         * Scaffolding
        ------------------------------------------*/
     $row = new LiteralField('', '<div class="row">');
     $column = new LiteralField('', '<div class="col-xs-12 col-sm-6">');
     $close = new LiteralField('', '</div>');
     /* -----------------------------------------
         * Fields
        ------------------------------------------*/
     $firstName = new TextField('FirstName', 'First Name');
     $firstName->setAttribute('required', 'required')->addExtraClass('form-control');
     $lastName = new TextField('LastName', 'Last Name');
     $lastName->setAttribute('required', 'required')->addExtraClass('form-control');
     $email = new EmailField('Email', 'Email Address');
     $email->setAttribute('required', 'required')->addExtraClass('form-control');
     $phone = new TextField('Phone', 'Phone Number (optional)');
     $phone->addExtraClass('form-control');
     $message = new TextareaField('Message', 'Message');
     $message->setAttribute('placeholder', _t('ContactPage.MessagePlaceholder', 'Enter your message'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $question = new TextField('Question', '3 &plus; 7 &equals; ?');
     $question->setAttribute('required', 'required')->addExtraClass('form-control');
     $fields = new FieldList($row, $column, $firstName, $close, $column, $lastName, $close, $close, $row, $column, $email, $close, $column, $phone, $close, $close, $message, $question);
     $action = new FormAction('SendContactForm', _t('ContactPage.SubmitText', 'Submit'));
     $action->addExtraClass('btn btn-primary btn-lg');
     $actions = new FieldList($action);
     $validator = new RequiredFields('FirstName', 'LastName', 'Email', 'Message');
     $form = Form::create($this, 'ContactForm', $fields, $actions, $validator);
     if ($formData = Session::get('FormInfo.Form_ContactForm.data')) {
         $form->loadDataFrom($formData);
     }
     return $form;
 }
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:37,代码来源:ContactPage.php

示例8: PostForm

 public function PostForm()
 {
     $fields = FieldList::create();
     if ($this->Options()->UserTitle) {
         $fields->push($title = TextField::create('Title', _t('MicroBlog.TITLE', 'Title')));
         $title->setAttribute('placeholder', _t('MicroBlog.TITLE_PLACEHOLDER', 'Title (optional)'));
     }
     $fields->push($taf = new TextareaField('Content', _t('MicroBlog.POST', 'Post')));
     $taf->setAttribute('placeholder', _t('MicroBlog.CONTENT_PLACEHOLDER', 'Add content here, eg text or a link'));
     $taf->setRows(3);
     $taf->addExtraClass('expandable');
     $taf->addExtraClass('postContent');
     $taf->addExtraClass('preview');
     $public = CheckboxField::create('PublicUsers', 'Public users', Config::inst()->get('TimelineController', 'default_public'));
     $loggedIn = CheckboxField::create('LoggedInUsers', "Logged in users", Config::inst()->get('TimelineController', 'default_logged_in'));
     $groups = Group::get()->filter("ParentID", 0);
     $specificGroups = null;
     if (class_exists('Multisites')) {
         $specificGroups = Multisites::inst()->getCurrentSite()->TargetedGroups();
     } else {
         $specificGroups = SiteConfig::current_site_config()->TargetedGroups();
     }
     if (count($specificGroups)) {
         $groups = $specificGroups;
     }
     $members = Member::get();
     if ($members->count() > $this->ajaxMemberLimit) {
         $member = AjaxSelect2Field::create('Members', "To")->setConfig('classToSearch', 'Member')->setConfig('multiple', true)->setConfig('searchFields', array('FirstName', 'Surname', 'Email'))->setConfig('resultsLimit', $this->ajaxMemberLimit);
     } else {
         $member = MultiSelect2Field::create('Members', "To", $members->map()->toArray())->setMultiple(true);
     }
     $group = MultiSelect2Field::create("Groups", "To Groups", $groups->map()->toArray())->setMultiple(true);
     $fields->push($public);
     $fields->push($loggedIn);
     $fields->push($member);
     $fields->push($group);
     $target = $this->getTargetFilter();
     if ($target) {
         $fields->push(HiddenField::create('PostTarget', '', $target));
     }
     $actions = new FieldList(new FormAction('savepost', _t('MicroBlog.SAVE', 'Add')));
     $form = new Form($this, 'PostForm', $fields, $actions);
     $this->extend('updatePostForm', $form);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-microblog,代码行数:45,代码来源:TimelineController.php


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