@@ -55,6 +55,9 @@ class SearchEditor extends Form
5555 /** @var bool */
5656 protected $ cleared = false ;
5757
58+ /** @var string[] The Condition's meta-data fields to add */
59+ protected array $ metaDataFields = [];
60+
5861 /**
5962 * Set the filter query string to populate the form with
6063 *
@@ -95,6 +98,13 @@ public function setSuggestionUrl(Url $url)
9598 return $ this ;
9699 }
97100
101+ public function setMetaDataFields (array $ fields ): static
102+ {
103+ $ this ->metaDataFields = $ fields ;
104+
105+ return $ this ;
106+ }
107+
98108 /**
99109 * Get the query string parser being used
100110 *
@@ -551,6 +561,19 @@ protected function createCondition(Filter\Condition $condition, $identifier)
551561 }]
552562 ]);
553563
564+ $ metaFields = new HtmlDocument ();
565+ foreach ($ this ->metaDataFields as $ fieldNameSuffix ) {
566+ $ name = $ identifier . '-column- ' . $ fieldNameSuffix ;
567+ $ columnMetaInput = $ this ->createElement ('hidden ' , $ name , [
568+ 'value ' => $ condition ->metaData ()->get ($ fieldNameSuffix )
569+ ]);
570+ $ this ->registerElement ($ columnMetaInput );
571+
572+ $ condition ->metaData ()->set ($ fieldNameSuffix , $ this ->getPopulatedValue ($ name ));
573+
574+ $ metaFields ->addHtml ($ columnMetaInput );
575+ }
576+
554577 $ operatorInput = $ this ->createElement ('select ' , $ identifier . '-operator ' , [
555578 'options ' => [
556579 '~ ' => '~ ' ,
@@ -588,6 +611,7 @@ protected function createCondition(Filter\Condition $condition, $identifier)
588611 $ columnInput ,
589612 $ columnFakeInput ,
590613 $ columnSearchInput ,
614+ $ metaFields ,
591615 $ operatorInput ,
592616 $ valueInput
593617 );
0 commit comments