From 56b9319d50cb73950a633b671f2c3db18999bc6a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 1 Nov 2019 09:57:25 -0400 Subject: [PATCH] Fix parser to work with nested fields Fields should be allowed to be inside other tags as long as they're contained in an af-fieldset. --- ext/afform/core/afform.php | 2 +- ext/afform/mock/ang/testAfform.aff.html | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index b1d41f5a84..bbd0b627b0 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -310,7 +310,7 @@ function afform_civicrm_alterAngular($angular) { foreach (pq('af-field', $doc) as $afField) { /** @var DOMElement $afField */ $fieldName = $afField->getAttribute('name'); - $entityName = pq($afField)->parent('[af-fieldset]')->attr('af-fieldset'); + $entityName = pq($afField)->parents('[af-fieldset]')->attr('af-fieldset'); if (!preg_match(';^[a-zA-Z0-9\_\-\. ]+$;', $entityName)) { throw new \CRM_Core_Exception("Cannot process $path: malformed entity name ($entityName)"); } diff --git a/ext/afform/mock/ang/testAfform.aff.html b/ext/afform/mock/ang/testAfform.aff.html index 824054eb4c..8e5e52ea73 100644 --- a/ext/afform/mock/ang/testAfform.aff.html +++ b/ext/afform/mock/ang/testAfform.aff.html @@ -7,8 +7,10 @@

About You

- - +
+ + +
-- 2.25.1