From d912b73aab50dc23e50f2609548df2aa4f5c06de Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Fri, 4 Jul 2014 18:20:26 +1000 Subject: [PATCH] Clean up event parameters to dev standards --- modules/backend/behaviors/FormController.php | 16 ++++++++-------- modules/backend/behaviors/ListController.php | 10 +++++----- modules/backend/behaviors/RelationController.php | 4 ++-- modules/backend/formwidgets/RecordFinder.php | 2 +- modules/backend/widgets/Form.php | 8 ++++---- modules/backend/widgets/Lists.php | 12 ++++++------ modules/cms/classes/Controller.php | 8 ++++---- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index ed141076a..7134225e7 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -79,20 +79,20 @@ class FormController extends ControllerBehavior */ $this->formWidget = $this->makeWidget('Backend\Widgets\Form', $config); - $this->formWidget->bindEvent('form.extendFieldsBefore', function($host) { - $this->controller->formExtendFieldsBefore($host); + $this->formWidget->bindEvent('form.extendFieldsBefore', function() { + $this->controller->formExtendFieldsBefore($this->formWidget); }); - $this->formWidget->bindEvent('form.extendFields', function($host) { - $this->controller->formExtendFields($host); + $this->formWidget->bindEvent('form.extendFields', function() { + $this->controller->formExtendFields($this->formWidget); }); - $this->formWidget->bindEvent('form.refreshBefore', function($host, $saveData) { - return $this->controller->formExtendRefreshData($host, $saveData); + $this->formWidget->bindEvent('form.beforeRefresh', function($saveData) { + return $this->controller->formExtendRefreshData($this->formWidget, $saveData); }); - $this->formWidget->bindEvent('form.refresh', function($host, $result) { - return $this->controller->formExtendRefreshResults($host, $result); + $this->formWidget->bindEvent('form.refresh', function($result) { + return $this->controller->formExtendRefreshResults($this->formWidget, $result); }); $this->formWidget->bindToController(); diff --git a/modules/backend/behaviors/ListController.php b/modules/backend/behaviors/ListController.php index 0a96c8c5e..77896c924 100644 --- a/modules/backend/behaviors/ListController.php +++ b/modules/backend/behaviors/ListController.php @@ -128,23 +128,23 @@ class ListController extends ControllerBehavior /* * Extensibility helpers */ - $widget->bindEvent('list.extendQueryBefore', function($host, $query) use ($definition) { + $widget->bindEvent('list.extendQueryBefore', function($query) use ($definition) { $this->controller->listExtendQueryBefore($query, $definition); }); - $widget->bindEvent('list.extendQuery', function($host, $query) use ($definition) { + $widget->bindEvent('list.extendQuery', function($query) use ($definition) { $this->controller->listExtendQuery($query, $definition); }); - $widget->bindEvent('list.injectRowClass', function($host, $record) use ($definition) { + $widget->bindEvent('list.injectRowClass', function($record) use ($definition) { return $this->controller->listInjectRowClass($record, $definition); }); - $widget->bindEvent('list.overrideColumnValue', function($host, $record, $column, $value) use ($definition) { + $widget->bindEvent('list.overrideColumnValue', function($record, $column, $value) use ($definition) { return $this->controller->listOverrideColumnValue($record, $column->columnName, $definition); }); - $widget->bindEvent('list.overrideHeaderValue', function($host, $column, $value) use ($definition) { + $widget->bindEvent('list.overrideHeaderValue', function($column, $value) use ($definition) { return $this->controller->listOverrideHeaderValue($column->columnName, $definition); }); diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 643d0ba10..9052dc6cc 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -585,7 +585,7 @@ class RelationController extends ControllerBehavior $config->noRecordsMessage = $emptyMessage; $widget = $this->makeWidget('Backend\Widgets\Lists', $config); - $widget->bindEvent('list.extendQueryBefore', function($host, $query) { + $widget->bindEvent('list.extendQueryBefore', function($query) { $this->relationObject->setQuery($query); if ($this->model->exists) { $this->relationObject->addConstraints(); @@ -668,7 +668,7 @@ class RelationController extends ControllerBehavior * Exclude existing relationships */ if ($this->manageMode == 'pivot' || $this->manageMode == 'list') { - $widget->bindEvent('list.extendQueryBefore', function($host, $query) { + $widget->bindEvent('list.extendQueryBefore', function($query) { /* * Where not in the current list of related records diff --git a/modules/backend/formwidgets/RecordFinder.php b/modules/backend/formwidgets/RecordFinder.php index b56ae444d..304738258 100644 --- a/modules/backend/formwidgets/RecordFinder.php +++ b/modules/backend/formwidgets/RecordFinder.php @@ -171,7 +171,7 @@ class RecordFinder extends FormWidgetBase $config->recordOnClick = sprintf("$('#%s').recordFinder('updateRecord', this, ':id')", $this->getId()); $widget = $this->makeWidget('Backend\Widgets\Lists', $config); - // $widget->bindEvent('list.extendQueryBefore', function($host, $query) { + // $widget->bindEvent('list.extendQueryBefore', function($query) { // /* // * Where not in the current list of related records diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index df83363c3..0092c41d9 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -256,7 +256,7 @@ class Form extends WidgetBase /* * Extensibility */ - $eventResults = $this->fireEvent('form.refreshBefore', [$this, $saveData]) + Event::fire('backend.form.refreshBefore', [$this, $saveData]); + $eventResults = $this->fireEvent('form.beforeRefresh', [$saveData]) + Event::fire('backend.form.beforeRefresh', [$this, $saveData]); foreach ($eventResults as $eventResult) $saveData = $eventResult + $saveData; @@ -289,7 +289,7 @@ class Form extends WidgetBase /* * Extensibility */ - $eventResults = $this->fireEvent('form.refresh', [$this, $result]) + Event::fire('backend.form.refresh', [$this, $result]); + $eventResults = $this->fireEvent('form.refresh', [$result]) + Event::fire('backend.form.refresh', [$this, $result]); foreach ($eventResults as $eventResult) $result = $eventResult + $result; @@ -309,7 +309,7 @@ class Form extends WidgetBase * Extensibility */ Event::fire('backend.form.extendFieldsBefore', [$this]); - $this->fireEvent('form.extendFieldsBefore', $this); + $this->fireEvent('form.extendFieldsBefore'); /* * Outside fields @@ -339,7 +339,7 @@ class Form extends WidgetBase * Extensibility */ Event::fire('backend.form.extendFields', [$this]); - $this->fireEvent('form.extendFields', $this); + $this->fireEvent('form.extendFields'); /* * Convert automatic spanned fields diff --git a/modules/backend/widgets/Lists.php b/modules/backend/widgets/Lists.php index 5d5a2e77c..95c4b7118 100644 --- a/modules/backend/widgets/Lists.php +++ b/modules/backend/widgets/Lists.php @@ -268,7 +268,7 @@ class Lists extends WidgetBase * Extensibility */ Event::fire('backend.list.extendQueryBefore', [$this, $query]); - $this->fireEvent('list.extendQueryBefore', [$this, $query]); + $this->fireEvent('list.extendQueryBefore', [$query]); /* * Related custom selects, must come first @@ -346,7 +346,7 @@ class Lists extends WidgetBase * Extensibility */ Event::fire('backend.list.extendQuery', [$this, $query]); - $this->fireEvent('list.extendQuery', [$this, $query]); + $this->fireEvent('list.extendQuery', [$query]); // Grouping due to the joinWith() call $query->select($selects); @@ -460,7 +460,7 @@ class Lists extends WidgetBase * Extensibility */ Event::fire('backend.list.extendColumns', [$this]); - $this->fireEvent('list.extendColumns', $this); + $this->fireEvent('list.extendColumns'); /* * Use a supplied column order @@ -544,7 +544,7 @@ class Lists extends WidgetBase if ($response = Event::fire('backend.list.overrideHeaderValue', [$this, $column, $value], true)) $value = $response; - if ($response = $this->fireEvent('list.overrideHeaderValue', [$this, $column, $value], true)) + if ($response = $this->fireEvent('list.overrideHeaderValue', [$column, $value], true)) $value = $response; return $value; @@ -575,7 +575,7 @@ class Lists extends WidgetBase if ($response = Event::fire('backend.list.overrideColumnValue', [$this, $record, $column, $value], true)) $value = $response; - if ($response = $this->fireEvent('list.overrideColumnValue', [$this, $record, $column, $value], true)) + if ($response = $this->fireEvent('list.overrideColumnValue', [$record, $column, $value], true)) $value = $response; return $value; @@ -596,7 +596,7 @@ class Lists extends WidgetBase if ($response = Event::fire('backend.list.injectRowClass', [$this, $record], true)) $value = $response; - if ($response = $this->fireEvent('list.injectRowClass', [$this, $record], true)) + if ($response = $this->fireEvent('list.injectRowClass', [$record], true)) $value = $response; return $value; diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index c4b13942a..342fd2793 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -129,7 +129,7 @@ class Controller extends BaseController if ($event = Event::fire('cms.page.beforeDisplay', [$this, $url, $page], true)) return $event; - if ($event = $this->fireEvent('page.beforeDisplay', [$this, $url, $page], true)) + if ($event = $this->fireEvent('page.beforeDisplay', [$url, $page], true)) return $event; /* @@ -215,7 +215,7 @@ class Controller extends BaseController if ($event = Event::fire('cms.page.display', [$this, $url, $page], true)) return $event; - if ($event = $this->fireEvent('page.display', [$this, $url, $page], true)) + if ($event = $this->fireEvent('page.display', [$url, $page], true)) return $event; if (!is_string($result)) @@ -450,7 +450,7 @@ class Controller extends BaseController if ($event = Event::fire('cms.page.start', [$this], true)) return $event; - if ($event = $this->fireEvent('page.start', [$this], true)) + if ($event = $this->fireEvent('page.start', [], true)) return $event; /* @@ -492,7 +492,7 @@ class Controller extends BaseController if ($event = Event::fire('cms.page.end', [$this], true)) return $event; - if ($event = $this->fireEvent('page.end', [$this], true)) + if ($event = $this->fireEvent('page.end', [], true)) return $event; return $response;