Permalink
Browse files

BUG Make RequestProcessor->filters settable as a property too

filters was a DI property that could only be set via constructor. This meant that modules couldnt add a
filter without interfering with other modules. With this change you can now add a config block like:

Injector:
  RequestProcessor:
    properties:
      filters:
        - "%$MyFilter"

Which will add a filter to RequestProcessors list of filters
  • Loading branch information...
1 parent 09067cc commit 35cc65820c2a02f97936d16622374bef1eb9b68e Hamish Friedlander committed Jul 19, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 control/RequestProcessor.php
View
4 control/RequestProcessor.php
@@ -14,6 +14,10 @@ public function __construct($filters = array()) {
$this->filters = $filters;
}
+ public function setFilters($filters) {
+ $this->filters = $filters;
+ }
+
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model) {
foreach ($this->filters as $filter) {
$res = $filter->preRequest($request, $session, $model);

0 comments on commit 35cc658

Please sign in to comment.