Get standard filter instance.
78 : Filter\Standard {
79 $ui = $this->
ui->factory();
80
81
83
84
86
87
88 $is_activated = $this->session->isActivated($filter_id, $is_activated);
89 $is_expanded = $this->session->isExpanded($filter_id, $is_expanded);
90
91
92 $inputs_with_session_data = [];
93 $is_input_initially_rendered_with_session = [];
94
95 if (count($inputs) != count($is_input_initially_rendered)) {
96 throw new \ArgumentCountError(
97 "Inputs and boolean values for initial rendering must be arrays of same size."
98 );
99 }
100
101 foreach ($inputs as $input_id =>
$i) {
102
103 $rendered =
104 $this->session->isRendered($filter_id, $input_id, current($is_input_initially_rendered));
105 $is_input_initially_rendered_with_session[] = $rendered;
106 next($is_input_initially_rendered);
107
108
109 $val = $this->session->getValue($filter_id, $input_id);
110 if (!is_null($val)) {
111 try {
112 $i =
$i->withValue($val);
113 }
catch (InvalidArgumentException
$e) {
114 }
115 }
116 $inputs_with_session_data[$input_id] =
$i;
117 }
118
119
120 $filter =
$ui->input()->container()->filter()->standard(
121 $this->request->getAction($base_action, self::CMD_TOGGLE_ON, true),
122 $this->request->getAction($base_action, self::CMD_TOGGLE_OFF, true),
123 $this->request->getAction($base_action, self::CMD_EXPAND),
124 $this->request->getAction($base_action, self::CMD_COLLAPSE),
125 $this->request->getAction($base_action, self::CMD_APPLY, true),
126 $this->request->getAction($base_action, self::CMD_RESET, true),
127 $inputs_with_session_data,
128 $is_input_initially_rendered_with_session,
129 $is_activated,
130 $is_expanded
131 );
132
133
135
136 return $filter;
137 }
writeFilterStatusToSession($filter_id, $inputs)
Write filter status to session (filter activated/expanded, inputs being rendered or not)
handleApplyAndToggle(string $filter_id, Filter\Standard $filter)
Handle apply and toggle commands.
handleReset(string $filter_id)
Handle reset command.