Introduce a function "is it a module or is it a theme?"

Created on 15 October 2012, over 12 years ago
Updated 8 June 2025, 16 days ago

Quoting @webchick from #1734642-152: Move breakpoint module into core β†’ "I wonder if it's worth a wrapper function that can handle the "is it a module or is it a theme?" question and dispatch accordingly."

This so we can avoid doing things like:

function my_function ($theme_key or _module_name) {
  $found = FALSE;
  $themes = list_themes();
  if (isset($themes[$theme_key or _module_name])) {
    $found = 'theme';
  }
  elseif (module_exists($theme_key or _module_name)) {
    $found = 'module';
  }
  else {
    return FALSE;
  }

  // ....

  switch ($found) {
    case 'theme':
      // use $themes[$theme_key]->info['name']
      break;
    case 'module':
      // use the machine name
      break;
  }
}
πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

extension system

Created by

πŸ‡§πŸ‡ͺBelgium attiks

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024