public function performDisabledTransformation() { if ($this->fieldType == 'CheckboxSetField') { return CheckboxSetField::performDisabledTransformation(); } return parent::performDisabledTransformation(); }
/** * Return a disabled version of this field. Keeps the composition but returns disabled * versions of all the child {@link FormField} objects. * * @return CompositeField */ public function performDisabledTransformation() { parent::performDisabledTransformation(); $newChildren = new FieldList(); $clone = clone $this; if ($clone->getChildren()) { foreach ($clone->getChildren() as $idx => $child) { if (is_object($child)) { $child = $child->transform(new DisabledTransformation()); } $newChildren->push($child, $idx); } } $clone->children = $newChildren; $clone->readonly = true; $clone->addExtraClass($this->extraClass()); $clone->setDescription($this->getDescription()); foreach ($this->attributes as $k => $v) { $clone->setAttribute($k, $v); } return $clone; }