本文整理汇总了PHP中CompositeField::insertBeforeRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP CompositeField::insertBeforeRecursive方法的具体用法?PHP CompositeField::insertBeforeRecursive怎么用?PHP CompositeField::insertBeforeRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompositeField
的用法示例。
在下文中一共展示了CompositeField::insertBeforeRecursive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: duplicateOrReplaceFields
protected function duplicateOrReplaceFields(&$fields)
{
$tasks = array('dup' => array());
foreach ($fields as $field) {
if ($field->isComposite()) {
$innertasks = $this->duplicateOrReplaceFields($field->FieldSet());
$tasks['dup'] = array_merge($tasks['dup'], $innertasks['dup']);
} else {
if (($fieldname = $field->Name()) && array_key_exists($fieldname, $this->original_values)) {
// Get a copy of the original field to show the untranslated value
if (is_subclass_of($field->class, 'TextareaField')) {
$nonEditableField = new ToggleField($fieldname, $field->Title(), '', '+', '-');
$nonEditableField->labelMore = '+';
$nonEditableField->labelLess = '-';
} else {
$nonEditableField = $field->performDisabledTransformation();
}
$nonEditableField_holder = new CompositeField($nonEditableField);
$nonEditableField_holder->setName($fieldname . '_holder');
$nonEditableField_holder->addExtraClass('originallang_holder');
$nonEditableField->setValue($this->original_values[$fieldname]);
$nonEditableField->setName($fieldname . '_original');
$nonEditableField->addExtraClass('originallang');
if (array_search($fieldname, $this->translatableFields) !== false) {
// Duplicate the field
if ($field->Title()) {
$nonEditableField->setTitle('Original');
}
$nonEditableField_holder->insertBeforeRecursive($field, $fieldname . '_original');
$tasks['dup'][$fieldname] = $nonEditableField_holder;
}
}
}
}
return $tasks;
}
示例2: insertBeforeRecursive
public function insertBeforeRecursive($field, $insertBefore, $level)
{
$level = parent::insertBeforeRecursive($field, $insertBefore, $level + 1);
if ($level === 0) {
$field->setTabSet($this);
}
return $level;
}