example.module in Coder 8.3
File
tests/DrupalPractice/Objects/drupal8/example.module
View source
<?php
function test() {
return \Drupal::configFactory();
}
function test2() {
return Node::load(1);
}
function test3() {
return format_date(time());
}
function test4() {
return t('Test');
}
Functions
Name |
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. |