From c3570ffd7e8004f93e8cc5f4349d02e890b67490 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Fri, 23 Jun 2017 08:11:41 +1000 Subject: [PATCH] The event emitter should not be a dependency Fixes #2938 --- modules/backend/widgets/Form.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index 8a34c8521..a94264871 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -1018,11 +1018,19 @@ class Form extends WidgetBase */ protected function applyFiltersFromModel() { + /* + * Standard usage + */ if (method_exists($this->model, 'filterFields')) { $this->model->filterFields((object) $this->allFields, $this->getContext()); } - $this->model->fireEvent('model.form.filterFields', [$this]); + /* + * Advanced usage + */ + if (method_exists($this->model, 'fireEvent')) { + $this->model->fireEvent('model.form.filterFields', [$this]); + } } /**