-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Elemental Area can't easily be added to a non-Page DataObject and edited in a ModelAdmin #871
Comments
Off the top of my head, I'm thinking we could
|
Related/ duplicate: #718 |
Possibly related: #965 |
I suggest to add a few changes in the CMSEditLink() method in class BaseElement. if (!$page instanceof SiteTree) {
if (method_exists($page, 'CMSEditLink')) {
$link = Controller::join_links($page->CMSEditLink(), 'ItemEditForm');
} else {
$link = null;
$this->extend('updateCMSEditLink', $link);
return $link;
}
} else {
$link = $page->CMSEditLink();
}
Other block of code, that I suggest to improve: if (!$this->inlineEditable() || $directLink) {
if (!$page instanceof SiteTree) {
$link = Controller::join_links($link,
'field',
$relationName,
'item',
$this->ID,
'edit'
);
} else {
$link = Controller::join_links(
singleton(CMSPageEditController::class)->Link('EditForm'),
$page->ID,
'field/' . $relationName . '/item/',
$this->ID,
'edit'
);
}
}
|
I'm going to provide an instruction how to use Elemental Area in DataObject and how to display these Elements on a Page in section "Model and DataBases. How To's " in Developer Guides |
Looks good ... I think those suggested improvement are a nice touch. When checking if a object has a method, use |
BaseElement::CMSEditLink
assumes that blocks are attached to an Object with aCMSEditLink
wethod. So when anElementalArea
is added to aDataObject
edited via a ModelAdmin, you'll get this errorObject->__call(): the method 'CMSEditLink' does not exist on 'SilverStripe\\FrameworkTest\\Model\\Company'
Acceptance Criteria
CMSEditLink
method or we come with a way to "guess" the edit linkStretch goal
Notes
There was some recent work to allow previews to be added to ModelAdmin. Ideally, tho solution to this card should work with tho preview as well.
PRs
The text was updated successfully, but these errors were encountered: