By admin , 18 October, 2025 Kernel test example for TwigExtension function <?php declare(strict_types=1); namespace Drupal\Tests\MYMODULE\Kernel; use Drupal\Core\Render\Markup; Tags tests twig
By admin , 18 October, 2025 Views: two contextual filters with "OR" By default views is using "AND" Tags views
By admin , 18 October, 2025 Docksal: access to local network (connect to LM Studio) Add to project docksal.yml Tags docker docksal
By admin , 17 October, 2025 Drupal.org Gitlab: pulling in new branches from an issue fork's parent You can then pull the latest branches from the parent origin, and push them to the issue-fork origin. For instance, to add Drupal Core 10.1.x, you could do this: Tags git drupal.org
By admin , 7 October, 2025 Append custom field to views programmatically /** * Implements hook_views_pre_view(). */ function MYMODULE_views_pre_view(ViewExecutable $view) { if ($view->id() === 'VIEWNAME') { $display_handler = $view->getDisplay(); $fields = $display_handler->getOption('fields'); $fields['blacklis Tags views field
By admin , 7 October, 2025 Simple views custom field plugin Add/** * {@inheritdoc} */ public function query() {}if you don't use any queriesUse 'views' table name ($data['views']) Tags views field
By admin , 22 September, 2025 Get client IP address $request_stack = \Drupal::service('request_stack'); $request = $request_stack->getCurrentRequest(); $ip_address = $request->getClientIp(); Tags request
By admin , 22 September, 2025 entityQuery: select entities created N days ago $timestamp = \Drupal::time()->getCurrentTime() - (180 * 24 * 60 * 60); $ids = \Drupal::entityQuery('activities') ->accessCheck(FALSE) ->condition('type', ['node_mention', 'comment_mention', 'comment_reply'], Tags entityQuery
By admin , 22 September, 2025 entityQuery: use several types $query = \Drupal::entityQuery('your_entity_type') ->condition('type', ['node_mention', 'comment_mention', 'comment_reply'], 'IN'); Tags entityQuery