You are here

function gin_lb_theme_suggestions_form_alter in Gin Layout Builder 1.0.x

Implements hook_theme_suggestions_HOOK_alter().

File

./gin_lb.module, line 252
Provides hooks for gin_lb module.

Code

function gin_lb_theme_suggestions_form_alter(array &$suggestions, array $variables) {
  if (gin_lb_is_valid_theme() === FALSE) {
    return;
  }
  if (strpos($variables['element']['#form_id'], 'layout_builder_form') !== FALSE) {
    $route_name = \Drupal::routeMatch()
      ->getRouteName();
    $gin_lb_show_toolbar = TRUE;
    \Drupal::moduleHandler()
      ->alter('gin_lb_show_toolbar', $gin_lb_show_toolbar);

    // Disable toolbar for layout library.
    // Layout builder is part of the layout library form.
    if (strpos($route_name, 'layout_builder.layout_library.') !== 0 && $gin_lb_show_toolbar === TRUE) {
      $suggestions[] = 'form__layout_builder_form__gin_lb';
    }
  }
}