Hide PHP warnings when variant template does not exist

Created on 28 April 2023, about 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 Chattanooga, TN, USA

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

Comments & Activities

Production build 0.69.0 2024