本文整理汇总了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'));
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例6: insertAfter
public function insertAfter($field, $insertAfter)
{
parent::insertBefore($field, $insertAfter);
if ($field instanceof ComponentFieldHolder_Item) {
$field->setHolder($this);
}
$this->sequentialSet = null;
}
示例7: insertBefore
public function insertBefore($field, $insertBefore)
{
parent::insertBefore($field, $insertBefore);
$field->setTabSet($this);
}