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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lostcarpark created an issue. See original summary.

lostcarpark’s picture

Title: Exclude SDCs with "noUI" from the component list » Exclude SDCs with "noUi" from the component list
lostcarpark’s picture

Version: 1.0.x-dev » 1.1.x-dev
Category: Bug report » Feature request

I 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.

lostcarpark’s picture

Status: Active » Needs review

Added 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.