Problem/Motivation
Currently the module includes all components on the site. However, some components are not intended to be used by front end users, so should be excluded.
Components excluded from front end will have "noUi: true".
Steps to reproduce
N/A
Proposed resolution
The fix is very simple: in ComponentRow::buildOptionsForm, we loop through components returned by getDefinitions(). This should check for the presence of the $definition['noUI'], and if present, should exclude the component.
We should also add a test case. This should also be simple:
- Clone
/tests/modules/views_row_sdc_test/components/test_card.
- Rename the copy to "hidden_card".
- We need minimal props and slots, so delete the Subtitle prop and the Media slot from the .component.yml and the .
- Add the line "noUi: true" to the component.
- In "tests/src/Kernel/ComponentRowTest.php", duplicate the "testOptionsFormHasComponentSelect" function.
- Modify to check the component "hidden_card" is now shown.
Remaining tasks
- Add check to exclude hidden components from drop-down.
- Create hidden test card component.
- Add test to verify hidden card does not appear in drop-down.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
lostcarpark commentedComment #3
lostcarpark commentedI logged this as a big report, bit on reflection, I think the current behaviour is as intended, so I'm calling it a feature request.
Comment #5
lostcarpark commentedAdded a hidden component with "noUi" set to true.
Added test that hidden excluded from select. Confirmed test fails.
Added check for noUi when adding components to select. Verified test now passes.
Moving to needs review.