From 0eaa6e27f2844abd1b25345f0e17df330baca78d Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 13 Sep 2019 12:55:26 -0400 Subject: [PATCH] (af-field) Rename "field-name" to "name" --- ext/afform/core/CRM/Afform/ArrayHtml.php | 2 +- ext/afform/core/Civi/Api4/Action/Afform/Prefill.php | 2 +- ext/afform/core/afform.php | 2 +- ext/afform/core/ang/af/Fieldset.js | 2 +- ext/afform/core/ang/afField/afField.js | 4 ++-- ext/afform/core/ang/afField/widgets/CheckBox.html | 2 +- ext/afform/docs/sandbox/planning-v0.3.md | 4 ++-- ext/afform/mock/ang/afex.aff.html | 4 ++-- .../mock/tests/phpunit/api/v4/formatExamples/banana.php | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ext/afform/core/CRM/Afform/ArrayHtml.php b/ext/afform/core/CRM/Afform/ArrayHtml.php index 7c24e53035..acf0ac6fcc 100644 --- a/ext/afform/core/CRM/Afform/ArrayHtml.php +++ b/ext/afform/core/CRM/Afform/ArrayHtml.php @@ -27,7 +27,7 @@ class CRM_Afform_ArrayHtml { 'data' => 'js', ], 'af-field' => [ - 'field-name' => 'text', + 'name' => 'text', 'defn' => 'js', ], 'af-fieldset' => [ diff --git a/ext/afform/core/Civi/Api4/Action/Afform/Prefill.php b/ext/afform/core/Civi/Api4/Action/Afform/Prefill.php index f3adcead23..0a05e550de 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/Prefill.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/Prefill.php @@ -46,7 +46,7 @@ class Prefill extends AbstractProcessor { } $result = civicrm_api4($entity['type'], 'get', [ 'where' => [['id', '=', $id]], - 'select' => array_column($entity['fields'], 'field-name'), + 'select' => array_column($entity['fields'], 'name'), 'checkPermissions' => $checkPermissions, ]); if ($result->first()) { diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index 714196b319..ae148d8bd0 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -181,7 +181,7 @@ function afform_civicrm_alterAngular($angular) { foreach (pq('af-field', $doc) as $afField) { /** @var DOMElement $afField */ - $fieldName = $afField->getAttribute('field-name'); + $fieldName = $afField->getAttribute('name'); $entityName = pq($afField)->parent('af-fieldset[af-name]')->attr('af-name'); // TEST ME 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/core/ang/af/Fieldset.js b/ext/afform/core/ang/af/Fieldset.js index 60b61e0942..6afe95b664 100644 --- a/ext/afform/core/ang/af/Fieldset.js +++ b/ext/afform/core/ang/af/Fieldset.js @@ -12,7 +12,7 @@ $scope.afFormCtrl = afFormCtrl; // This is faster than waiting for each field directive to register itself $('af-field', $el).each(function() { - afFormCtrl.registerField($scope.afName, $(this).attr('field-name')) + afFormCtrl.registerField($scope.afName, $(this).attr('name')) }); }, controller: function($scope){ diff --git a/ext/afform/core/ang/afField/afField.js b/ext/afform/core/ang/afField/afField.js index 63b79967f6..fb618405af 100644 --- a/ext/afform/core/ang/afField/afField.js +++ b/ext/afform/core/ang/afField/afField.js @@ -1,12 +1,12 @@ (function(angular, $, _) { - // Example usage: + // Example usage: angular.module('afField').directive('afField', function() { return { restrict: 'E', require: ['^afFieldset', '^afForm'], templateUrl: '~/afField/afField.html', scope: { - fieldName: '@', + fieldName: '@name', // TEST ME defn: '=' }, link: function($scope, $el, $attr, ctrls) { diff --git a/ext/afform/core/ang/afField/widgets/CheckBox.html b/ext/afform/core/ang/afField/widgets/CheckBox.html index f652a022da..bf0bd8bb9e 100644 --- a/ext/afform/core/ang/afField/widgets/CheckBox.html +++ b/ext/afform/core/ang/afField/widgets/CheckBox.html @@ -1,6 +1,6 @@ diff --git a/ext/afform/docs/sandbox/planning-v0.3.md b/ext/afform/docs/sandbox/planning-v0.3.md index e8ea3ab287..d7daf040cc 100644 --- a/ext/afform/docs/sandbox/planning-v0.3.md +++ b/ext/afform/docs/sandbox/planning-v0.3.md @@ -167,14 +167,14 @@ - + - + diff --git a/ext/afform/mock/ang/afex.aff.html b/ext/afform/mock/ang/afex.aff.html index ef5d156df5..edbd2b3bae 100644 --- a/ext/afform/mock/ang/afex.aff.html +++ b/ext/afform/mock/ang/afex.aff.html @@ -9,13 +9,13 @@ - + - + diff --git a/ext/afform/mock/tests/phpunit/api/v4/formatExamples/banana.php b/ext/afform/mock/tests/phpunit/api/v4/formatExamples/banana.php index 5d3441133e..af5c134adf 100644 --- a/ext/afform/mock/tests/phpunit/api/v4/formatExamples/banana.php +++ b/ext/afform/mock/tests/phpunit/api/v4/formatExamples/banana.php @@ -1,19 +1,19 @@ '
New text!
', + 'html' => '
New text!
', 'shallow' => [ '#tag' => 'div', '#children' => [ ['#tag' => 'strong', '#children' => ['New text!']], - ['#tag' => 'af-field', 'field-name' => 'do_not_sms', 'defn' => "{label: 'Do not do any of the emailing'}"], + ['#tag' => 'af-field', 'name' => 'do_not_sms', 'defn' => "{label: 'Do not do any of the emailing'}"], ], ], 'deep' => [ '#tag' => 'div', '#children' => [ ['#tag' => 'strong', '#children' => ['New text!']], - ['#tag' => 'af-field', 'field-name' => 'do_not_sms', 'defn' => ['label' => 'Do not do any of the emailing']], + ['#tag' => 'af-field', 'name' => 'do_not_sms', 'defn' => ['label' => 'Do not do any of the emailing']], ], ], ]; -- 2.25.1