Skip to content
Snippets Groups Projects

Issue #3343198: Improve documentation of hook_theme_suggestions_HOOK_alter()

Closed Andy Blum requested to merge issue/drupal-3343198:3343198-improve-documentation-of into 10.1.x

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Andy Blum added 1 commit

    added 1 commit

    Compare with previous version

  • Andy Blum resolved all threads

    resolved all threads

  • added 1 commit

    Compare with previous version

  • Lauri Timmanee
  • 97 foreach ($suggestions as $key => &$suggestion) {
    98 $hook = $hook ?? $variables['theme_hook_original'];
    99 // Valid suggestions are $hook, $hook__*, and contain no hyphens.
    100 if (($suggestion !== $hook && !str_starts_with($suggestion, $hook . '__')) || str_contains($suggestion, '-')) {
    101 $invalid_suggestions[] = $suggestion;
    102 unset($suggestions[$key]);
    103 continue;
    104 }
    97 105 $template = strtr($suggestion, '_', '-') . $extension;
    98 106 $prefix = ($template == $current_template) ? 'x' : '*';
    99 107 $suggestion = $prefix . ' ' . $template;
    100 108 }
    101 109 $output['debug_info'] .= "\n<!-- FILE NAME SUGGESTIONS:\n " . Html::escape(implode("\n ", $suggestions)) . "\n-->";
    110
    111 if (!empty($invalid_suggestions)) {
    112 $output['debug_info'] .= "\n<!-- INVALID FILE NAME SUGGESTIONS:\n " . Html::escape(implode("\n ", $invalid_suggestions)) . "\n-->";
  • Lauri Timmanee
  • Lauri Timmanee
  • Andy Blum added 1 commit

    added 1 commit

    • 8cb61908 - update documentation wording

    Compare with previous version

  • Andy Blum added 2 commits

    added 2 commits

    • bb28be4a - rename $hook to $base_hook
    • ae6ebe6a - add valid/invalid suggestion examples

    Compare with previous version

  • Andy Blum
  • Andy Blum added 1 commit

    added 1 commit

    • c31d1e9a - dont overwrite $base_hook if it already exists

    Compare with previous version

  • Andy Blum added 32 commits

    added 32 commits

    Compare with previous version

  • Andy Blum added 1 commit

    added 1 commit

    • aff67c14 - add link to hook_theme_suggestions_alter docs with invalid patterns

    Compare with previous version

  • Andy Blum added 1 commit

    added 1 commit

    Compare with previous version

  • Andy Blum added 1 commit

    added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 40 commits

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading