Опубликовано 22/10/2019
- urls
$current_url = \Drupal\Core\Url::fromRoute('<current>', array(), array("absolute" => TRUE))->toString(); // get full url
- Variables
Drupal\Core\Site\Settings::get('some_setting_here'); // Get a setting from settings.php
- Nodes
$id = $node->id(); // get node id $node_type = $node->getType(); // get node type
// get terms ids related to node $terms = $node->get('field_sometaxonomyfield')->getValue(); $terms = array_column($terms, 'target_id');
- Twig
Print full url{{ url('<current>') }}
Raw value of a field
{{ node.field_somefield.value }}
print image from image_field
{{ content.field_imagefield.0 }}
Добавить комментарий