Hide PHP warnings when variant template does not exist

Created on 28 April 2023, over 1 year ago

Problem/Motivation

Sometimes a variant doesn't need its own template. E.g., when the only change is adding a class based on the presence of the "variant" context variable.

Steps to reproduce

Declare a variant in the *.component.yml that doesn't have its own template and see this warning appear:

Warning: file_get_contents(themes/custom/wildrose/templates/components/molecules/topics/topics--dark.twig): Failed to open stream: No such file or directory in Drupal\cl_components\Component\ComponentMetadata->detectNamedBlocks() (line 295 of /var/www/html/web/modules/contrib/cl_components/src/Component/ComponentMetadata.php).

Proposed resolution

Check the file exists before performing some logic?

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States hawkeye.twolf α™αŽ©α―αα— Unalatogiyasdi, Tsalaguwetiyi (Cherokee country)

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024