Skip to content

Commit 05ab8bd

Browse files
authored
Pass current model to RelationController view & manage scopes
This improves the extensibility of the relation controller by passing the parent relation model to the query scope that will be applied to both the view and manage options. It allows the use of attributes of the parent relation model in the query scope applied to the relation. This is a mirror of october/octobercms#2419, except for the relation controller instead of the record finder widget. If necessary, I can create a case in the test plugin, but if this is simple enough with the added reference to the prior PR to not require a case in the test plugin, that would be simpler for me :) @daftspunk, let me know what you think.
1 parent d1268c9 commit 05ab8bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/backend/behaviors/RelationController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ protected function makeViewWidget()
645645
}
646646
elseif ($scopeMethod = $this->getConfig('view[scope]')) {
647647
$widget->bindEvent('list.extendQueryBefore', function($query) use ($scopeMethod) {
648-
$query->$scopeMethod();
648+
$query->$scopeMethod($this->model);
649649
});
650650
}
651651
else {
@@ -775,7 +775,7 @@ protected function makeManageWidget()
775775
}
776776
elseif ($scopeMethod = $this->getConfig('manage[scope]')) {
777777
$widget->bindEvent('list.extendQueryBefore', function($query) use ($scopeMethod) {
778-
$query->$scopeMethod();
778+
$query->$scopeMethod($this->model);
779779
});
780780
}
781781
else {

0 commit comments

Comments
 (0)