use 'cols' as key instead of 'columns' for note_columns per coleman
authorJeff Kellem <github-dist@beyond.dreams.org>
Sat, 2 Dec 2023 04:22:12 +0000 (20:22 -0800)
committerJeff Kellem <github-dist@beyond.dreams.org>
Sat, 2 Dec 2023 04:22:12 +0000 (20:22 -0800)
As suggested in this comment from @colemanw:
https://github.com/civicrm/civicrm-core/pull/28388#issuecomment-1835717428

Note: This will also turn a prop of `columns` into `cols` for the key not just for a `note_columns` prop.

Civi/Api4/Service/Spec/SpecFormatter.php
ext/afform/core/ang/af/fields/TextArea.html

index b1b66b3c73bccb0a366ecb9de4ae35abe138d187..2d6c1c2020f75d71d4a7fe8324d76b782811040d 100644 (file)
@@ -322,7 +322,9 @@ class SpecFormatter {
     if ($inputType == 'TextArea') {
       foreach (['rows', 'cols', 'note_rows', 'note_columns'] as $prop) {
         if (!empty($data[$prop])) {
-          $inputAttrs[str_replace('note_', '', $prop)] = (int) $data[$prop];
+          $key = str_replace('note_', '', $prop);
+          $key = str_replace('columns', 'cols', $key);  // per @colemanw https://github.com/civicrm/civicrm-core/pull/28388#issuecomment-1835717428
+          $inputAttrs[$key] = (int) $data[$prop];
         }
       }
     }
index 7abbde7379e0be58867b10c1bb505ea3005ee834..06c1314a40123b3ee4379e28279c292c8417c9b3 100644 (file)
@@ -1 +1 @@
-<textarea class="crm-form-textarea" id="{{:: fieldId }}" rows="{{:: $ctrl.defn.input_attrs.rows || 4 }}" cols="{{:: $ctrl.defn.input_attrs.columns || 60 }}" ng-required="$ctrl.defn.required" ng-model="getSetValue" ng-model-options="{getterSetter: true}" ></textarea>
+<textarea class="crm-form-textarea" id="{{:: fieldId }}" rows="{{:: $ctrl.defn.input_attrs.rows || 4 }}" cols="{{:: $ctrl.defn.input_attrs.cols || 60 }}" ng-required="$ctrl.defn.required" ng-model="getSetValue" ng-model-options="{getterSetter: true}" ></textarea>