Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. GlobalFunctionSniff.php

GlobalFunctionSniff::$functions

List of global functions that should not be called.

Type: string[]

File

vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/Objects/GlobalFunctionSniff.php, line 31

Class

GlobalFunctionSniff
Checks that global functions like t() are not used in forms or controllers.

Namespace

DrupalPractice\Sniffs\Objects

Code

protected $functions = [
    'drupal_get_destination' => 'the "redirect.destination" service',
    'drupal_render' => 'the "renderer" service',
    'entity_load' => 'the "entity_type.manager" service',
    'file_load' => 'the "entity_type.manager" service',
    'format_date' => 'the "date.formatter" service',
    'node_load' => 'the "entity_type.manager" service',
    'node_load_multiple' => 'the "entity_type.manager" service',
    'node_type_load' => 'the "entity_type.manager" service',
    't' => '$this->t()',
    'taxonomy_term_load' => 'the "entity_type.manager" service',
    'taxonomy_vocabulary_load' => 'the "entity_type.manager" service',
    'user_load' => 'the "entity_type.manager" service',
    'user_role_load' => 'the "entity_type.manager" service',
];

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal