Open mehov opened 9 months ago
Dirty workaround
/**
* Before render callback.
*
* @param \Cake\Event\Event $event The beforeRender event.
* @return void
*/
public function beforeRender(\Cake\Event\EventInterface $event)
{
// prevent linking to the table plugin: start
$viewBuilderVars = $this->viewBuilder()->getVars();
if (isset($viewBuilderVars['associations'])) {
foreach ($viewBuilderVars['associations'] as &$association) {
foreach ($association as &$associationTable) {
$associationTable['plugin'] = null;
}
}
}
$this->set('associations', $viewBuilderVars['associations']);
// prevent linking to the table plugin: end
if ($this->viewBuilder()->getClassName() === null) {
$this->viewBuilder()->setClassName('CrudView\View\CrudView');
}
}
Results in:
The plugin alias is being automatically picked up from the table name in dot notation here: https://github.com/FriendsOfCake/crud-view/blob/28f1bcdc43d52135f816499d5222cdea08dc9359/src/Listener/ViewListener.php#L578
Using it in link generation has been introduced in FriendsOfCake/crud-view#138
I looked at the code and there doesn't seem to be an obvious way to tell the system that while I use the table from another plugin, the links shouldn't refer to it.
I'm hoping there's a way to somehow pass some flag through in an event callback of some kind?