- 🇧🇪Belgium weseze
@greatmatter: I've updated the patch for version 4 by returing an empty string instead of NULL and updating the functions signature.
@jdearie: I think it should be possible, since cshs allows this (I think). However I have not implemented most of the features cshs offers in the webform element, because it is way out of scope for my client...
- 🇺🇸United States greatmatter
It appears the latest Webform RC has broken this--I'm not entirely sure why, however...
- 🇺🇸United States johnnydarkko
Using the patch in #11, I'm now seeing the option to use CSHS:
I was expecting to find some extra settings here, but nothing else shows up--I think this is where my issue is originating. Where should I be finding the CSHS options?
After enabling CSHS, I get a few PHP warnings when viewing the webform:
Warning: Undefined array key "hierarchy_depth" in Drupal\cshs\CshsWebformHelper->formElement() (line 297 of modules/contrib/cshs/src/CshsOptionsFromHelper.php).
Warning: Undefined array key "save_lineage" in Drupal\cshs\CshsWebformHelper->formElement() (line 306 of modules/contrib/cshs/src/CshsOptionsFromHelper.php).
Warning: Undefined array key "force_deepest" in Drupal\cshs\CshsWebformHelper->formElement() (line 309 of modules/contrib/cshs/src/CshsOptionsFromHelper.php).
Warning: Undefined array key "required_depth" in Drupal\cshs\CshsWebformHelper->formElement() (line 310 of modules/contrib/cshs/src/CshsOptionsFromHelper.php).
I also get a javascript error when I try to load the webform:
Uncaught TypeError: $(...).once is not a function attach cshs.ts:14 attachBehaviors drupal.js:166 attachBehaviors drupal.js:162 <anonymous> drupal.init.js:32 listener drupal.init.js:20 domReady drupal.init.js:26 <anonymous> drupal.init.js:31 <anonymous> drupal.init.js:34
I found that the settings array is empty:
Additional details:
Drupal 10.1.6
PHP 8.1.18
CSHS 4.0.0
Theme: Tara → - 🇺🇸United States jdearie
I wanted to come back and post the answer to my question - in case others were trying to do the same.
I need to store the full hierarchy of the term select with cshs widget. None of the options in the Item format options in the Submission Display field worked.
After much much research, I discovered
{{ item.breadcrumb }}
That token stores the full path. I also updated the Custom Settings / Custom properties. By default, the save_lineage is set to false, so I set it to true. I'm not actually sure I needed to do that last part or not, but I did.
- Click the Advanced tab on the element you wish to edit
- Expand the SUBMISSION DISPLAY fieldset.
- Select Custom... from the Item format field in the SINGLE ITEM fieldset.
- Type
{{ item.breadcrumb }}
in the Item format custom HTML field - Scroll down to CUSTOM SETTINGS and set the save lineage to true:
save_lineage: true
- 🇺🇾Uruguay santiagotrindade
@johnnydarkko, I’m not sure if you’ve found a solution, but in my case, I didn’t need those fields, so I resolved the issue by merging the `$settings` with the default settings. I’m not creating a patch for this, as it’s probably not the best solution and may not address the issue in the long term. However, it helped me avoid those warnings:
- $settings = $this->getSettings(); + $settings = $this->getSettings() + self::defaultSettings();