New answers tagged

0

There are many modules that provide access control by term or taxonomy; Such as: Permissions by Term Taxonomy Access Control Lite


1

If the "node" entity type does not exist, you have a fundamentally broken installation, but it's not possible to say exactly how it's broken based on the information given. There are a couple things I would inspect at this point: Is your local database complete? Did the import perhaps fail? Is the cache out-of-date? Try truncating every database ...


0

This was my approach for programmatically adding and removing a node from a group on update. A removeContent() function would be helpful. However for my situation, I had to check if the entity was in the Group anyways, which gave me the GroupContent object that I could delete to remove the entity from the group. /** * Implements hook_ENTITY_TYPE_update(). *...


2

Are you asking how to preprocess node type specific? use \Drupal\node\Entity\Node; // #### implements hook_preprocess_html() #### function yourmodule_preprocess_html(&$variables) { switch ( $variables['node']->getType() ) { // ## node-type: products ## case 'products': ... break; // ## node-type: users ## case 'users': ... break; default:...


1

You don't need to use blocks: You can create a view with a page and an attachment. First from admin/structure/views/add, you create a view for content, selecting the content type to show and selecting Create a page. Click on Save and edit. On the next page, which shows the view settings, click on the + Add button and select Attachment. The next page will ...


0

Nodes, taxonomy terms and paragraphs are all different types of entities. Each entity type has unique properties that make it better suited for different use cases and content types. Here’s a breakdown of the most important Drupal terminology you need to know to structure your content: Node: A page of content is a node, accessible via its own URL Taxonomy ...


1

In special case of navigating to a node page (like when viewing an article) you can see that when implementing hook_preprocess_page , the $variables does contain a 'node' value, if you add any property to your $variables['node'] , you will be able to use it in node.html.twig file Update As in hook_preprocess_page you can access all regions using $variables['...


0

It looks like the issue stemmed from incorrect SQL syntax. The last column after the SELECT should not contain a comma.


0

You're using an D7 callback definition. It needs to be defined as a D8+ callback. So this: function button_test_callback($form, &$form_state) { Should be this: function button_test_callback(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {


0

In Drupal 8 and 9 i just do this sort of thing. $form['revision_log']['#required'] = TRUE; $form['revision_log']['widget']['#required'] = TRUE; $form['revision_log']['widget'][0]['#required'] = TRUE; $form['revision_log']['widget'][0]['value']['#required'] = TRUE;


Top 50 recent answers are included