Having followed the excellent explanation for How to create a view with filters and pagination, I have a custom field that filters for the most part. As it is, the code in the custom field is retrieving the filtering data from what is posted via jInput
, and it works splendidly. However, if the user returns to the page (without the filtering data being posted), then Search Tools detects that there is an active filter, thus shows, but does not populate the form with the filter data (it's not in the post, thus nothing to populate the form with).
Clearly, I should be retrieving the filtering data from somewhere else, apparently the form, but I can't figure out how to get to it. In the custom field form code, I can see the filters and data, but can't figure out the correct method(s) to get to it in order to fill the form before rendering.
So from the custom fields $this
, how do I get to the protected form, then to the protected registry object, and ultimately to the protected data/filter as shown below?
JFormFieldMyCustomField Object
(
[type:protected] => mycustomfield
[input_type:JFormFieldMycustomfield:private] =>
.
.
.
[form:protected] => JForm Object (
[data:protected] => Joomla\Registry\Registry Object (
[data:protected] => stdClass Object (
[filter] => stdClass Object (
[search] =>
[myfield2] => 95
[myfield1] => Array (
[0] => 4
[1] => 5
[2] => 6
[3] => 37
)
)
)