How to create TWIG templates in a custom module for Drupal ?

I created a custom module for Drupal 8.9

I have the Drupal Commerce and Group modules.

I want to create 3 pages and use TWIG templates :

  • /user/ID/tasks
  • /srore/ID/tasks
  • /group/ID/tasks

I want to create a template by type of group and store. How can I do this ?

My module is certainly full of errors.

With my code, the pages are well created, but the TWIG is not rendered.

task_notify.routing.yml

Why am I getting nodes that have been deleted in the array returned by node->fieldName->getValue()?

In the snippet below, I'm trying to get all of the donations content type for the current page so I can iterate over some information on each of them.  However, when I use var_dump on the array containing all of these donations that I want, it shows an array with 57 donations, when I only have 3.  

Presumably, it is no coincidence that the first 54 donations look like this:

[0]=> array(3) { 
  ["target_id"]=> string(2) "25" 
  ["_attributes"]=> array(0) { } 
  ["_loaded"]=> bool(false) 
}

and the last 3 look like:

How to create a TWIG for my personalized module ?

I just created my first custom module for Drupal 8.9

I want to create a TWIG for my page. How to do ?

Here is the complete module, it is not finished :

https://git.drupalcode.org/sandbox/zenimagine-3076032/-/tree/master/

task_notify.module

Direct, after login, users to the content they can create based on their role

When the user registers, he chooses for himself whether to register as a 'company' or as a 'professional' by assigning himself a role.
Each role can only create one type of content (e.g. Company role can create ctype Company/Professional role can create ctype Professional).

How to create a message at login that, only if the user has not yet created one, warns and directs him according to the role to the content he can create?

"The website encountered an unexpected error. Please try again later."

I get this error, on login page and "admin/structure/menu/manage/main": "The website encountered an unexpected error. Please try again later."

When I look at the log, there seems to be something wrong in the core: I have no idea how to debug this. I'd be greatful if someone could help with this.

Two Drupal codebase htaccess rewrite

Hi All!

I want to place two Drupal core directory, eg. a_core and b_core because when I update modules and core, the a_core serving, I update b_core, when b_core serving, update a_core.

Before core directories have a .htaccess file, which selected actual core directory:

RewriteEngine On

Options +FollowSymlinks

RewriteBase /
RewriteCond %{HTTP_HOST} ^website\.com [NC]
RewriteRule ^(.*)$ /a_core/$1

After update, in the htaccess file change RewriteRule to b_core, so doesn't neccessary Drupal maintanance mode.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x