Questions tagged [9]

Version tags should be used only for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
-3 votes
0 answers
12 views

Single page being ignored by View

I use views for listing pages belonging to a content type. The only Filter criteria are that pages must be published and they must belong to the said content type. One page complies with both ...
user avatar
  • 1
0 votes
0 answers
8 views

How can I get Average of a comment field by node_id?

I have Comments here wherein user can rate a content. I want to get the average rating per content, how do I efficiently get the average? I have the following code to get the Average: $cids = \Drupal::...
user avatar
1 vote
0 answers
10 views

Why is the order/weight of blocks added to region not saved?

I have used layout builder to manage display on the default display of a content type.I have not selected "overrides allowed" so that this is the global layout for this content type. I see ...
user avatar
  • 844
-2 votes
0 answers
29 views

Generate pdfs that are 508 compliant in Drupal 9 [closed]

I would like to know if there it is possible to generate a pdf that is 508 compliant. I have used Zend pdf, but it doesn't generate 508 compliant pdfs. Couldn't find anything useful in the ...
user avatar
  • 31
0 votes
0 answers
17 views

How upload a file\image via json api?

I'm trying to upload a file or image on a D9 site via json api. The test is namely to upload the user picture on the user entity. I've been following the documentation or read questions about, but I ...
user avatar
  • 470
1 vote
0 answers
16 views

Entity Access permissions with entity print module

I havethe module EntityPrint https://www.drupal.org/project/entity_print installed on my site. I works perfectly (creates a pdf) when connected as admin and doesn't work with an anonymous user. It ...
user avatar
2 votes
1 answer
79 views

Use a different twig media template if it is being rendered inside a WYIWYG

I have a twig template for a media entity that I wish to be able to embed into a WYIWYG. I am able to, however the entity has issues rendering when inside the ckeditor that aren't present when ...
user avatar
  • 5,000
1 vote
1 answer
31 views

How can I set "advanced" metatags programmatically?

The Metatag documentation gives an example of setting meta tags like this: $node->set('field_meta_tags', serialize([ 'title' => 'Some title', 'description' => 'Some description.', '...
user avatar
0 votes
0 answers
31 views

Module is required but can't uninstall because incompatible with core

I seem to be stuck with with a catch22, I updated from Drupal 8 to 9 and now I'm getting an error on many admin pages: 'The module t7_starbase does not exist or is not installed.' drush pm-enable ...
user avatar
  • 527
1 vote
2 answers
41 views

How do I use Feeds Tamper to process multiple CSV columns into a single field?

I have a CSV file that I import into my site using Feeds Tamper. The CSV file has columns like URL path Favorite vegetable Favorite fruit Favorite pasta In Drupal, my content type has a JSON Field, ...
user avatar
0 votes
0 answers
19 views

Creating links in TableSelect rows

I've created a module which defines a Form, but when I try to add a column of links, it is empty when I set the '#type' to 'link'. I am testing this on Drupal 9.3.x. On the surface, this is the same ...
user avatar
0 votes
1 answer
12 views

Changing the Moderation State Control Box input to a textarea

I wanted to change the moderation state control box input to a textarea like the image below shows. Currently the input only supports 128 characters but I believe log messages can hold much more in ...
user avatar
  • 627
0 votes
1 answer
40 views

How to solve "Mismatched entity and/or field definitions", specifically, "The URL alias field needs to be installed"?

After migrating from 7.89 to 9.3.12 this warning appears: ENTITY/FIELD DEFINITIONS Mismatched entity and/or field definitions The following changes were detected in the entity type and field ...
user avatar
0 votes
1 answer
24 views

How to access node entity reference on comment save via rules?

I have a content type with a user reference field on it, the users are populated here by a view. When a user saves a comment, I want to access that field and send an email to user in the entity ...
user avatar
  • 1
0 votes
1 answer
29 views

How to pass Block ID to a view?

I have a Custom Block type called HomeBlocks. This bundle has a paragraphs field which allows multiple paragraphs. I then place (using Layout Builder) an instance of this block type on my home page (a ...
user avatar
  • 888
0 votes
1 answer
33 views

View data export with custom table doesn't work if user is not admin

I'm working on a Drupal 9 website displaying custom table data and I need to provide CSV/XLS export links for it. For the moment, I've defined a view consuming the custom table data thanks to the ...
user avatar
  • 1
1 vote
1 answer
24 views

Search is very slow for certain roles

I'm a bit lost here. I have a strange problem and don't know where to begin. I use the core search function on a website I build. When I am logged in as administrator this search function is working ...
user avatar
  • 894
1 vote
1 answer
55 views

Custom theme function for a Field

I want to change a theme hook for one field from a custom FieldFormatter. It's #theme callback is 'field' but I want to give the user the option to toggle a setting that changes this to 'field_raw', ...
user avatar
  • 26.3k
1 vote
1 answer
67 views

How to find module that is updating my node after insert

When trying to create a new book i get the following message: Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '53' for key 'PRIMARY': ...
user avatar
  • 894
0 votes
0 answers
32 views

How to custom access for entity paragraphs_type?

I have a problem with entity paragraphs_type, when I add a paragraphs_type in a node, with paragraph items inside, and I set it unpublish status, anonymous users can still see it. I try to custom ...
user avatar
0 votes
1 answer
40 views

Use HTTP_REFERER within a twig template

I have a FAQ page with five nested bootstrap 5 accordions and I need to have one accordion item or another open depending on the page the user is coming from. I tried using this: {% set previousURL = ...
user avatar
  • 1
0 votes
1 answer
18 views

How do I grab a field from a referenced item in views?

I currently have a view block called Offerings that shows up on all my Course content-type pages that display all the offerings for the said course. These offerings are their own content type called ...
user avatar
0 votes
1 answer
26 views

How to refresh and reload (with ajax?) order checkout panes and order calculation independent from commerce cart refresh (e.g. billing address change)

I have following problem: During checkout, my customer has to fill in his billing address (at least at the first time) to calculate VAT rate and gross price. Further calculation is done via an order ...
user avatar
  • 129
0 votes
1 answer
23 views

Why don't users with the "Create new content" permission for a custom bundle cannot access /node/add, but they can access /node/add/author?

If I give to a custom role the Article: Create new content permission, users can access the /node/add page. However, if I give the same permission for a custom bundle, for example Author: Create new ...
user avatar
  • 470
1 vote
0 answers
25 views

Change the state of a checkboxes field

I know how to use conditions with Form API for fields like text-field, checkbox, for example, showing or hiding a field when a checkbox is checked. $form['lorem'] = [ '#type' => 'checkbox', '#...
user avatar
0 votes
0 answers
15 views

Views contextual filter, can you add more than one 'has taxonomy term' with different validation/share rules?

I have a View that grabs the current node, and looks at taxonomy on the node page as a contextual filter argument. I want one vocabulary to require shares any terms (OR), and I want another to share ...
user avatar
  • 26.3k
1 vote
1 answer
40 views

Migrate CSV to content type with paragraphs

I'm trying to import a CSV File into Content Types and Paragraphs, using Migrate module (and mainly this tutorial : https://mtech-llc.com/blog/charlotte-leon/migration-csv-data-paragraphs). For this I ...
user avatar
0 votes
1 answer
39 views

Help with Views Field Plugin

I am trying to make a views field plugin that provides some additional functionality to a field for me. I am having issues with it. I have an entity type called an lms_request. It has numerous bundles ...
user avatar
  • 161
0 votes
1 answer
66 views

Programmatically change view mode of media field

I'm attempting to change the view mode of a media field programmatically. I've created a view mode called 'modal'. I created a mytheme_preprocess_media hook and attempted to change the view mode a ...
user avatar
  • 5,000
0 votes
0 answers
28 views

How do I unset a link?

I want to programmatically decide whether to render a link or not. This should apply to all links e.g anchor tags (no wysywigs) Not only menu links. I tried using hook_link_alter. /** * Implements ...
user avatar
0 votes
1 answer
50 views

Token service not replacing text with term as a token

I'm trying to use the token service to replace a piece of text using a Taxonomy Term. Example: Hi [term:field_first_name], ... The term is getting loaded correctly, but the text is not changing: $...
user avatar
0 votes
1 answer
25 views

Upload directory with no prefix (://) was not found for file uploads

I am not able to get file uploads of any type to work on my Drupal instance when I attempt to add media using the built in form. When I upload an image file, I get: And looking at the log messages in ...
user avatar
  • 253
0 votes
0 answers
47 views

How to Update Multi Value Entity Reference Field Programatically [duplicate]

I have two Node Content Types type_a and type_b I have a field called as field_author_profile in type_a which is entity reference field to type_b with cardinality unlimited. How do I update ...
user avatar
1 vote
0 answers
63 views

View with a path of api/VERSION/foo/bar/%node - %node is not being upcast to a Node object

I am trying to create a handful of Views with a REST Export display. They have paths set behind 'api/.../.../.../%node' where %node will be an ID sent to the request to be upcasted. The basic View has ...
user avatar
  • 26.3k
0 votes
0 answers
8 views

Module for CKEditor that provides a button to check for broken links

Are there any modules for Drupal 9 that provide a button for CKeditor that allows the user to check for broken links before saving the content? I imagine it working like this: The user goes to a node ...
user avatar
  • 627
0 votes
0 answers
58 views

How to get node information in RouteSubscriberBase::alterRoutes

what I'm trying to achieve, is to for some specific nodes set admin theme. I have defined RouteSubscriberBase but how can I get node information here? This code is not working $node = \Drupal::...
user avatar
0 votes
2 answers
36 views

Access Denied for programmatically added file to a node

I have a custom script that imports contents from an external database. I'm attaching files using the below custom code. $file = File::create([ 'filename' => $new_filename, 'uri' => $...
user avatar
  • 11
1 vote
0 answers
32 views

Create a Context/Condition and get a view display used on the page

I want to create a context/condition plugin that checks the total results returned from a view display on the page (its a block), and if its less/greater than a certain figure, hide certain peripheral ...
user avatar
  • 26.3k
1 vote
1 answer
28 views

Warning: file_put_contents(): Filename cannot be empty

After updating Drupal 8 to Drupal 9, the following error is displayed on the website page: Warning: file_put_contents(): Filename cannot be empty in /var/www/html/web/modules/contrib/devel/src/...
user avatar
  • 11
1 vote
1 answer
51 views

How to invoke a custom operation in Views

I have a View that lists some nodes. Each node instance has a boolean - "Spam" - that defaults to FALSE. In the view there is an "Operations" column where there shall be a link ...
user avatar
  • 14.7k
0 votes
1 answer
52 views

Set a <front> page for different languages?

Is there a way to specify the front page per language of a Drupal 9 site? I am looking for an interface that allows this to be set by a user.
user avatar
  • 26.3k
-2 votes
0 answers
41 views

How do I render a variable in a template file?

I am setting $variables['hello_world'] in template_preprocessor_page(). I want to render in the views-view-fields--hello.html.twig file, but {{ hello_world }} doesn't render it. I am looking for help.
user avatar
0 votes
0 answers
18 views

How to alter the end date views query for search api

I'm trying to alter an exposed date filter in a view I created that uses solr search api. I noticed that the end date filter doesn't work unless I add a day to the end date. so for example if i have ...
user avatar
  • 408
-2 votes
1 answer
66 views

After update to PHP 8, module no longer works

I have updated my Drupal from 8 to 9 and used PHP 7.4. Now I have chosen the time to update to PHP 8. Everything runs so far, only with a self-built module I get now an Error message: The website ...
user avatar
0 votes
1 answer
25 views

Overriding Drupal.ajax.prototype is not working

I am trying to override Drupal.ajax.prototype.beforeSend like this: (function($) { // In mymodule.js, which appears after ajax.js in the page build Drupal.ajax.prototype.beforeSend = function(...
user avatar
1 vote
0 answers
12 views

JSON:API FieldEnhancers - removing a resource object from a JSON:API response

I need to remove a resource object (in this case a paragraph) from a JSON:API response when it matches a specific condition. I do not want to delete it, I just want to exclude the object from the ...
user avatar
  • 11
-1 votes
1 answer
48 views

How can I override a displayed node with the content rendered by a custom module?

I have a path /application, which is rendered by a custom module (through a combination of theme hook/controller/routing/twig). It's basically a mini-application. I also have a Drupal node /data, ...
user avatar
  • 253
2 votes
2 answers
63 views

How to use a referenced entity's values in a TableSort?

I have a custom entity with a field which is defined as follows. $fields['file'] = BaseFieldDefinition::create('file') ->setDescription('Reference to the built-in core File entity type.') ->...
user avatar
1 vote
0 answers
21 views

Why am I getting different results for entity::save() between REST and web?

I'm refactoring my user entities to use entity bundle classes. Before, I saved the value of a time offset in a field using hook_user_presave(): // Initialize in user timezone. $user_timezone = ...
user avatar
-2 votes
2 answers
77 views

After I upgraded the site, some admin pages get a "Field storage definition for 'uuid' could not be found." error

Upgrading Drupal 8 to Drupal 9 went smooth and without any issues, but now when I visit admin/reports/status or admin/modules/uninstall, I get this exception. Drupal\Core\Field\FieldException: Field ...
user avatar

1
2 3 4 5
22