Debug queries
Code
<?php
\DB::enableQueryLog(); // Enable query log
// execute queries
print \DB::getQueryLog(); // Show results of
// build query ($Q)
print str_replace_array('?', $Q->getBindings(), $Q->toSql());
?>
<?php
\DB::enableQueryLog(); // Enable query log
// execute queries
print \DB::getQueryLog(); // Show results of
// build query ($Q)
print str_replace_array('?', $Q->getBindings(), $Q->toSql());
?>
namespace Drupal\module_name\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use DrupalRoute
luberri.nor:
path: '/nor/{user}'
defaults:
_controller: '\Drupal\luberri\Controller\LuberriController::nor'
requirements:
_permission: 'access content'
options:
parameters:
user:
type: entity:user
Controller
use Drupal\Core\Controller\ControllerBase; use Symfony\Component\HttpFoundation\Request; use Drupal\Core\Session\AccountInterface;
Controller function
Styled image source
{{ 'public://images/my_image.jpg' | image_style('medium') }}
Get label form list type field:
{% set list_id = node.field_name.value %}
{{ node.field_name.getSetting('allowed_values')[list_id] }}
Node links: