subtheme.theme file not recognized

Created on 27 September 2023, 9 months ago
Updated 27 June 2024, 1 day ago

I am on Drupal 9

I am using W3css as by base theme (drupal8_w3css_theme).
My theme's name is storm. All my templates and CSS files are recognized and they do change the layout and look and feel as I want.

However here is the problem.

I want add storm_form_node_form_alter hook in my storm.theme file
I added it however there is no effect.

I even kept a syntax error (not closing the parenthesis at the end of function!!!) Even that error was not recognized. Whole thing still worked ! (along with the other layout and css changes as desired).

I tried the following things ... but all in vain.

  1. storm.theme file
  2. theme-settings.php file in .../themes/custom/storm directory
  3. uninstall storm theme and reinstall it

the hook overriding is not effective ... because the file is not recognized.

πŸ’¬ Support request
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

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

Comments & Activities

  • Issue created by @mvelanka
  • Assigned to flashwebcenter
  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,
    I have this hook (hook_form_BASE_FORM_ID_alter()) used in the theme file drupal8_w3css_theme.theme line 444. This hook will work only on node add or edit and if you don't see any changes, that's because you are not using the theme as an admin theme.

    You can create a custom module and use this hook inside it. recommended.
    You can create a sub-theme to the active admin theme and you this hook inside. Not my choice.
    You can use the w3css theme as an admin theme and you will see this code. Not recommended.

    I attached the sub-theme I used for testing.
    Best wishes,
    Alaa

  • Issue was unassigned.
  • Status changed to Active 9 months ago
  • flashwebcenter,

    I hope I have understood this, that this hook will be used only if/when my theme is used as admin theme.

    But then, the hook is still used from my base theme ..drupal8_w3css_theme, (even when that is not the admin theme either). I see that is getting used because the effect is to get the two column containerized node edit form. .. and also I could print a debug log message from drupal8_w3css_theme.theme file ... confirming that the hook is visited.

    How does that work?

  • This got solved accidentally. See this comment in the drupal forum:
    solved (accidently!!) β†’

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    I saw the comment, my recommendation is to use a custom module. The node form is the form you use when adding content, whatever theme you are using in your-site-dot-com/node/add should have the hook. Here is an example in Drupal core: https://git.drupalcode.org/project/claro/-/blob/8.x-2.x/claro.theme?ref_... line 494.

    Best wishes,
    Alaa

  • Assigned to flashwebcenter
  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX
  • Thanks for the prompt support.

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    You are welcome!

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX
Production build 0.69.0 2024