No Code Attached Yet J4 Issue bug
avatar Hackwar
Hackwar
15 Jan 2019

I have a subform field with multiple and a filelist field inside. Since I want to have the directory of the filelist field configurable, I have to modify the subform XML during runtime. There currently is no way to modify that. The only thing that worked was:

$field = $form->getField('attachments');
$subform = new \SimpleXmlElement($field->formsource);
$files = $subform->xpath('field[@name="file"]');
$files[0]->addAttribute('directory', JPATH_ROOT . '/' . $params->get('attachment_folder'));
$form->load('<form><field name="attachments" type="subform" '
		. 'label="COM_MAILS_FIELD_ATTACHMENTS_LABEL" multiple="true" '
		. 'layout="joomla.form.field.subform.repeatable-table">'
		. str_replace('<?xml version="1.0"?>', '', $subform->asXML())
		. '</field></form>');

We should have some way to modify that in a more sane way.

avatar Hackwar Hackwar - open - 15 Jan 2019
avatar joomla-cms-bot joomla-cms-bot - change - 15 Jan 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Jan 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Category Fields
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J4 Issue
avatar jwaisner jwaisner - change - 24 Mar 2020
Status Discussion New
Build staging 4.0-dev
avatar Hackwar Hackwar - change - 19 Feb 2023
Labels Added: No Code Attached Yet bug
Removed: ?
avatar Hackwar Hackwar - labeled - 19 Feb 2023

Add a Comment

Login with GitHub to post a comment