Skip to content

Commit

Permalink
FIX Call updated method
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 11, 2024
1 parent a17c038 commit 0632428
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Form/AbstractLinkField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -169,11 +172,11 @@ protected function getOwnerFields(): array
// Elemental content block
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,
Expand Down

0 comments on commit 0632428

Please sign in to comment.