You are here

example.module in Coder 8.3

Same filename and directory in other branches
  1. 8.3.x tests/DrupalPractice/Objects/drupal8/example.module

File

tests/DrupalPractice/Objects/drupal8/example.module
View source
<?php

/**
 * Using \Drupal here is allowed since this code runs in the global namespace.
 */
function test() {
  return \Drupal::configFactory();
}

/**
 * Loading nodes directly is allowed since we run in the global namespace.
 */
function test2() {
  return Node::load(1);
}

/**
 * Global function is allowed since we run in the global namespace.
 */
function test3() {
  return format_date(time());
}

/**
 * Using t() is allowed since we run in the global namespace.
 */
function test4() {
  return t('Test');
}

Functions

Namesort descending Description
test Using \Drupal here is allowed since this code runs in the global namespace.
test2 Loading nodes directly is allowed since we run in the global namespace.
test3 Global function is allowed since we run in the global namespace.
test4 Using t() is allowed since we run in the global namespace.