Problem/Motivation
ON_ATTACH_TO_ROOT is unexpected here:
public function attachToSlot(Request $request, string $builder_id, string $instance_id, string $slot): HtmlResponse {
...
return $this->dispatchDisplayBuilderEvent(
$is_move ? DisplayBuilderEvents::ON_MOVE : DisplayBuilderEvents::ON_ATTACH_TO_ROOT,
$builder_id,
NULL,
$instance_id,
$parent_id,
);
Same onAttachToRoot & onAttachToSlot:
- Buttons: HistoryButtons, StateButtons, ActiveUsers
- Contextual: UiStylesPanel, UiSkinsPanel, InfoPanel, InstanceFormPanel, VisibilityConditionsPanel
- View: LogsPanel, PreviewPanel
Different onAttachToRoot & onAttachToSlot:
- BuilderPanel and its children: LayersPanel, TreePanel
This must affect performance (we are sending way too much HTML than necessary) and this may explain some weird behaviours there.
Proposed resolution
Fix ApiController::attachToSlot() and test BuilderPanel LayersPanel & TreePanel. Maybe some JS or PHP mechanism were built around this error.
Issue fork display_builder-3540701
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
pdureau commentedAccordign to Jean:
So the expected change must be to keep the mechanism but to rename something and add a comment
Comment #5
grimreaperComment #6
grimreaperIn attachToSlot, what is the point to have $instance_id in the route, when it is also obtained with parameters?
$request->request->has('instance_id')Except for a debug message.
Also if we "move to root a component", why is it the attachToSlot method that is called?
Not sure I am the best to know what is to be renamed/commented.
Comment #7
pdureau commented@mogtofu33?
Comment #8
mogtofu33 commentedBoth instances are different, moving something to a slot trigger a post:
There's a chance it's not needed, this where we need to investigate. This is mostly a legacy code.
There is 2 cases:
Comment #9
pdureau commentedComment #10
pdureau commentedHi,
#3576984: Error: [attachToSlot] moveToSlot failed with invalid data has fixed:
Does that mean this issue can be closed as "duplicate" or "outdated"?
Comment #11
mogtofu33 commentedSeems yes.