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


PHP CompositeField::insertBefore方法代碼示例

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


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

示例1: testFieldPosition

 public function testFieldPosition()
 {
     $compositeOuter = new CompositeField(new TextField('A'), new TextField('B'), $compositeInner = new CompositeField(new TextField('C1'), new TextField('C2')), new TextField('D'));
     $this->assertEquals(0, $compositeOuter->fieldPosition('A'));
     $this->assertEquals(1, $compositeOuter->fieldPosition('B'));
     $this->assertEquals(3, $compositeOuter->fieldPosition('D'));
     $this->assertEquals(0, $compositeInner->fieldPosition('C1'));
     $this->assertEquals(1, $compositeInner->fieldPosition('C2'));
     $compositeOuter->insertBefore('B', new TextField('AB'));
     $this->assertEquals(0, $compositeOuter->fieldPosition('A'));
     $this->assertEquals(1, $compositeOuter->fieldPosition('AB'));
     $this->assertEquals(2, $compositeOuter->fieldPosition('B'));
 }
開發者ID:XDdesigners,項目名稱:silverstripe-framework,代碼行數:13,代碼來源:CompositeFieldTest.php

示例2: insertBefore

 /**
  * Inserts a field before a particular field in a FieldSet.
  *
  * @param FormField $item The form field to insert
  * @param string $name Name of the field to insert before
  */
 public function insertBefore($field, $insertBefore)
 {
     parent::insertBefore($field, $insertBefore);
     if ($field instanceof Tab) {
         $field->setTabSet($this);
     }
     $this->sequentialSet = null;
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:14,代碼來源:TabSet.php

示例3: baseTransform

 protected function baseTransform($nonEditableField, $originalField)
 {
     $fieldname = $originalField->Name();
     $nonEditableField_holder = new CompositeField($nonEditableField);
     $nonEditableField_holder->setName($fieldname . '_holder');
     $nonEditableField_holder->addExtraClass('originallang_holder');
     $nonEditableField->setValue($this->original->{$fieldname});
     $nonEditableField->setName($fieldname . '_original');
     $nonEditableField->addExtraClass('originallang');
     $nonEditableField->setTitle('Original ' . $originalField->Title());
     $nonEditableField_holder->insertBefore($originalField, $fieldname . '_original');
     return $nonEditableField_holder;
 }
開發者ID:eLBirador,項目名稱:AllAboutCity,代碼行數:13,代碼來源:Translatable.php

示例4: baseTransform

 /**
  * Transform a translatable field to show the field value from the default language
  * DataObject below the translated field.
  * 
  * This is a fallback function which handles field types that aren't transformed by
  * $this->transform{FieldType} functions.
  * 
  * @param FormField $nonEditableField The readonly field to contain the original value
  * @param FormField $originalField The original editable field containing the translated value
  * @return \CompositeField The transformed field
  */
 protected function baseTransform($nonEditableField, $originalField)
 {
     $fieldname = $originalField->getName();
     $nonEditableField_holder = new CompositeField($nonEditableField);
     $nonEditableField_holder->setName($fieldname . '_holder');
     $nonEditableField_holder->addExtraClass('originallang_holder');
     $nonEditableField->setValue($this->original->{$fieldname});
     $nonEditableField->setName($fieldname . '_original');
     $nonEditableField->addExtraClass('originallang');
     $nonEditableField->setTitle(_t('Translatable_Transform.OriginalFieldLabel', 'Original {title}', 'Label for the original value of the translatable field.', array('title' => $originalField->Title())));
     $nonEditableField_holder->insertBefore($originalField, $fieldname . '_original');
     return $nonEditableField_holder;
 }
開發者ID:camfindlay,項目名稱:silverstripe-translatable,代碼行數:24,代碼來源:Translatable.php

示例5: insertBefore

 /**
  * Inserts a field before a particular field in a FieldList.
  *
  * @param string $insertBefore Name of the field to insert before
  * @param FormField $field The form field to insert
  * @return	FormField|null
  */
 public function insertBefore($insertBefore, $field)
 {
     if ($field instanceof Tab) {
         $field->setTabSet($this);
     }
     return parent::insertBefore($insertBefore, $field);
 }
開發者ID:XDdesigners,項目名稱:silverstripe-framework,代碼行數:14,代碼來源:TabSet.php

示例6: insertAfter

 public function insertAfter($field, $insertAfter)
 {
     parent::insertBefore($field, $insertAfter);
     if ($field instanceof ComponentFieldHolder_Item) {
         $field->setHolder($this);
     }
     $this->sequentialSet = null;
 }
開發者ID:milkyway-multimedia,項目名稱:ss-mwm-formfields,代碼行數:8,代碼來源:ComponentFieldHolder.php

示例7: insertBefore

 public function insertBefore($field, $insertBefore)
 {
     parent::insertBefore($field, $insertBefore);
     $field->setTabSet($this);
 }
開發者ID:ramziammar,項目名稱:websites,代碼行數:5,代碼來源:TabSet.php


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