當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HiddenField::setAttribute方法代碼示例

本文整理匯總了PHP中HiddenField::setAttribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP HiddenField::setAttribute方法的具體用法?PHP HiddenField::setAttribute怎麽用?PHP HiddenField::setAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HiddenField的用法示例。


在下文中一共展示了HiddenField::setAttribute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateLinkForm

 public function updateLinkForm($form)
 {
     Requirements::javascript("linkableobjects/javascript/CustomHtmlEditorField.js");
     $count = 0;
     foreach ($form->Fields() as $field) {
         $count++;
         if ($count == 2) {
             $linkType = $field->fieldByName('LinkType');
             $types = $linkType->getSource();
             $link = new HtmlEditorField_LinkObjects();
             $linkableObjects = $link->getLinkableObjects();
             foreach ($linkableObjects as $object => $title) {
                 $types[$object] = $title;
                 $picker = new DataObjectPicker($object . 'LinkID', $title);
                 $picker->setConfig('limit', 5);
                 $picker->setConfig('classToPick', $object);
                 $picker->setForm($form);
                 $field->insertBefore($picker, 'Description');
             }
             $linkMap = new HiddenField('LinkableObjects');
             $linkMap->setAttribute('data-map', json_encode($linkableObjects));
             $field->push($linkMap);
             $linkType->setSource($types);
         }
     }
 }
開發者ID:helpfulrobot,項目名稱:sam-costigan-linkableobjects,代碼行數:26,代碼來源:HtmlToolbar_Extension.php

示例2: ItemEditForm

 /**
  * Builds an item edit form
  *
  * @return Form
  */
 public function ItemEditForm()
 {
     // If there are no record set, redirect back to the "main" model admin
     if (empty($this->record) || $this->record->ID == 0) {
         $controller = Controller::curr();
         $noActionURL = $controller->removeAction($_REQUEST['url']);
         $controller->getResponse()->removeHeader('Location');
         //clear the existing redirect
         return $controller->redirect($noActionURL, 302);
     }
     // Create form field
     $fields = new FieldList();
     $chartData = new HiddenField('FlowchartData');
     $chartData->setAttribute('data-chart-storage', 'true');
     $fields->push($chartData);
     $existsOnLive = $this->record->getExistsOnLive();
     // Create the action buttons
     $majorActions = CompositeField::create()->setName('MajorActions')->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
     $actions = new FieldList(array($majorActions));
     if ($this->record->canEdit()) {
         $majorActions->push(FormAction::create('doSave', _t('SiteTree.BUTTONSAVED', 'Saved'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true));
     }
     if ($this->record->canPublish() && !$this->record->IsDeletedFromStage) {
         // "publish", as with "save", it supports an alternate state to show when action is needed.
         $majorActions->push($publish = FormAction::create('publish', _t('SiteTree.BUTTONPUBLISHED', 'Published'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true));
         // Set up the initial state of the button to reflect the state of the underlying SiteTree object.
         if ($this->record->stagesDiffer('Stage', 'Live')) {
             $publish->addExtraClass('ss-ui-alternate');
         }
     }
     $form = new Form($this, 'ItemEditForm', $fields, $actions);
     $form->loadDataFrom($this->record);
     $form->Backlink = $this->getBackLink();
     $form->setTemplate('Flowchart_EditForm');
     return $form;
 }
開發者ID:helpfulrobot,項目名稱:adrexia-flowchart,代碼行數:41,代碼來源:GridFieldFlowchartDetailForm.php


注:本文中的HiddenField::setAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。