@@ -155,6 +155,28 @@ public function editFieldAction()
155155
156156 $ field = $ this ->fetchProperty ($ uuid );
157157
158+
159+ $ db = $ this ->db ->getDbAdapter ();
160+ $ query = $ db
161+ ->select ()->from ('director_property ' )
162+ ->where ('uuid = ? ' , $ uuid ->getBytes ());
163+
164+ $ property = $ db ->fetchRow ($ query );
165+
166+ $ hasFields = ($ property ->value_type === 'array ' && $ property ->instantiable !== 'y ' )
167+ || $ property ->value_type === 'dict ' ;
168+
169+ if ($ hasFields ) {
170+ $ itemTypeQuery = $ db
171+ ->select ()->from ('director_property ' , 'value_type ' )
172+ ->where (
173+ 'parent_uuid = ? AND key_name = \'0 \'' ,
174+ $ uuid ->getBytes ()
175+ );
176+
177+ $ property ->item_type = $ db ->fetchOne ($ itemTypeQuery );
178+ }
179+
158180 $ this ->addTitleTab (sprintf ($ this ->translate ('Edit Field: %s ' ), $ field ['key_name ' ]));
159181
160182 $ propertyForm = (new PropertyForm ($ this ->db , $ uuid , true , $ parentUuid ))
@@ -181,6 +203,29 @@ public function editFieldAction()
181203 ->handleRequest ($ this ->getServerRequest ());
182204
183205 $ this ->addContent ($ propertyForm );
206+
207+ if ($ hasFields ) {
208+ $ this ->addContent (new HtmlElement ('h2 ' , null , Text::create ($ this ->translate ('Fields ' ))));
209+ $ button = (new ButtonLink (
210+ Text::create ($ this ->translate ('Add Field ' )),
211+ Url::fromPath ('director/property/add-field ' , [
212+ 'uuid ' => $ uuid ->toString ()
213+ ]),
214+ null ,
215+ ['class ' => 'control-button ' ]
216+ ))->openInModal ();
217+
218+ $ fieldQuery = $ db
219+ ->select ()
220+ ->from ('director_property ' )
221+ ->where ('parent_uuid = ? ' , $ uuid ->getBytes ())
222+ ->order ('key_name ' );
223+
224+ $ this ->addContent ($ button );
225+
226+ $ fields = new PropertyTable ($ db ->fetchAll ($ fieldQuery ), true );
227+ $ this ->addContent ($ fields );
228+ }
184229 }
185230
186231 /**
0 commit comments