ai_upgrade_assistant-0.2.0-alpha2/tests/fixtures/test_module/test_module.module

tests/fixtures/test_module/test_module.module
<?php

/**
 * @file
 * Contains test_module.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function test_module_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.test_module':
      return t('This is a test module for performance testing.');
  }
}

/**
 * Implements hook_node_view().
 */
function test_module_node_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {
  // Add deprecated function calls for testing
  if (function_exists('drupal_set_message')) {
    drupal_set_message('Test message');
  }
  
  $build['test_field'] = [
    '#markup' => t('Test field'),
    '#weight' => 100,
  ];
}

/**
 * Implements hook_form_alter().
 */
function test_module_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // Add deprecated code patterns
  if ($form_id == 'node_form') {
    $form['#validate'][] = 'test_module_custom_validate';
  }
}

/**
 * Custom validation function using deprecated patterns.
 */
function test_module_custom_validate($form, &$form_state) {
  // Use deprecated variable_get
  if (function_exists('variable_get')) {
    $value = variable_get('test_setting', '');
  }
  
  // Use deprecated db_query
  if (function_exists('db_query')) {
    $result = db_query('SELECT * FROM {node}');
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc