By admin , 13 September, 2024 Add secondary tab to user local tasks Needs minimum 2 subtabs! custom.links.task.yml: Tags tabs views
By admin , 12 August, 2024 Run post update hook again drush ev '$updates = \Drupal::keyValue("post_update")->get("existing_updates"); \Drupal::keyValue("post_update")->set("existing_updates", array_diff_key($updates, array_filter($updates, function($v){return FALSE !== strstr($v,"MY_MODULE_post_update");})));' Tags drush
By admin , 1 August, 2024 Render node programmatically /** * Implements hook_ENTITY_TYPE_view(). */ function MYMODULE_user_view(array &$build, UserInterface $account, EntityViewDisplayInterface $display) { if ($component = $display->getComponent('dating')) { $node = Node::load('67'); $view_builder = \Drupal::entityTypeManage Tags render node
By admin , 31 July, 2024 Get user role labels $roles = Role::loadMultiple($user->getRoles()); foreach ($roles as $role) { $label = $role->label(); } Tags roles
By admin , 31 July, 2024 Set view title programmatically /** * Implements hook_views_post_render(). */ function MYMODULE_views_post_render(ViewExecutable $view) { if ($view->element['#view_id'] === 'user_blog') { $title = 'test'; $view->setTitle($title); } } Tags views
By admin , 11 July, 2024 Inject StreamWrapperManager use Drupal\Core\StreamWrapper\StreamWrapperManager; /** * The Stream Wrapper Manager. */ protected StreamWrapperManager $streamWrapperManager; /** * {@inheritdoc} */ public Tags dependency injection
By admin , 25 June, 2024 Use DeprecationHelper for compatibility Call to deprecated method renderPlain() of class Drupal\Core\Render\Renderer in drupal:10.3.0 and is removed from drupal:12.0.0. Tags deprecation
By admin , 25 June, 2024 Phpstan: ignore some identifier // @phpstan-ignore class.notFound Tags phpstan
By admin , 1 May, 2024 Add css class to body with node type /** * Implements hook_preprocess_HOOK(). */ function MYTHEME_preprocess_html(&$variables) { /** @var \Drupal\node\Entity\NodeType $node_type_entity */ $node_type_entity = \Drupal::routeMatch()->getParameter('node_type'); if ($node_type_entit Tags preprocess