olivero_test.module

Same filename and directory in other branches
  1. 10 core/modules/system/tests/modules/olivero_test/olivero_test.module
  2. 11.x core/modules/system/tests/modules/olivero_test/olivero_test.module

Functions to support testing the Olivero theme.

File

core/modules/system/tests/modules/olivero_test/olivero_test.module

View source
<?php


/**
 * @file
 * Functions to support testing the Olivero theme.
 */


/**
 * Implements hook_preprocess_field_multiple_value_form().
 */
function olivero_test_preprocess_field_multiple_value_form(&$variables) {
  // Set test multiple value form field to disabled
  if ($variables["element"]["#field_name"] === "field_multiple_value_form_field") {
    $variables['element']['#disabled'] = TRUE;
  }
}

/**
 * Implements hook_preprocess().
 */
function olivero_test_preprocess_page(&$variables) {
  $route = \Drupal::routeMatch()->getRouteName();
  switch ($route) {
    case 'js_message_test.links':
      $messenger = \Drupal::messenger();
      $messenger->addStatus('PHP Status');
      $messenger->addWarning('PHP Warning');
      $messenger->addError('PHP Error');
      break;

    default:
      break;

  }
}

/**
 * Implements hook_preprocess_html().
 */
function olivero_test_preprocess_html(&$variables) {
  $variables['#attached']['library'][] = 'olivero_test/log-errors';
}

Functions

Title Deprecated Summary
olivero_test_preprocess_field_multiple_value_form Implements hook_preprocess_field_multiple_value_form().
olivero_test_preprocess_html Implements hook_preprocess_html().
olivero_test_preprocess_page Implements hook_preprocess().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.