From 37aa71416dc80a569eaddbb97a98beaec1ad13f5 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 11 Nov 2024 15:45:43 +1300 Subject: [PATCH] FIX Call updated method --- src/Form/AbstractLinkField.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Form/AbstractLinkField.php b/src/Form/AbstractLinkField.php index ff0f6f18..c3606743 100644 --- a/src/Form/AbstractLinkField.php +++ b/src/Form/AbstractLinkField.php @@ -3,13 +3,16 @@ namespace SilverStripe\LinkField\Form; use DNADesign\Elemental\Controllers\ElementalAreaController; +use DNADesign\Elemental\Forms\EditFormFactory; use DNADesign\Elemental\Models\BaseElement; use InvalidArgumentException; use LogicException; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; +use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormField; +use SilverStripe\Forms\TextField; use SilverStripe\LinkField\Models\Link; use SilverStripe\LinkField\Services\LinkTypeService; use SilverStripe\ORM\DataObject; @@ -170,10 +173,11 @@ protected function getOwnerFields(): array if (class_exists(BaseElement::class) && is_a($owner, BaseElement::class)) { // Remove namespaces from inline editable blocks // This will return an empty array for non-inline editable blocks (e.g. blocks in a gridfield) - $arr = ElementalAreaController::removeNamespacesFromFields([$relation => ''], $owner->ID); - if (!empty($arr)) { - $relation = array_key_first($arr); - } + $factory = Injector::inst()->get(EditFormFactory::class); + $field = TextField::create($relation); + $fields = FieldList::create([$field]); + $factory->removeNamespaceFromFields($fields, ['Record' => $owner]); + $relation = $field->getName(); } return [ 'ID' => $owner->ID,