当前位置: 首页>>代码示例>>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;未经允许,请勿转载。