Questions tagged [8]

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

Filter by
Sorted by
Tagged with
-1 votes
0 answers
57 views

How to create and return a file generated by mPDF from a form submit?

I want to create a demo pdf after a form submit. I have used mPDF library and run composer require mpdf/mpdf to install it. Currently the library is installed in ROOT_FOLDER/vendor/mpdf. Now I have ...
Souvik Das's user avatar
0 votes
0 answers
41 views

Update FieldItemBase database schema

I need to update a default value of column /** * {@inheritdoc} */ public static function schema(FieldStorageDefinitionInterface $field_definition) { return [ 'columns' => [ 'status' ...
Vanish's user avatar
  • 166
0 votes
0 answers
44 views

route resolving corrupted

I have a weird situation. Somehow some routes got corrupted and I cannot fix them. So the /user/:uid/edit and /user/register are corrupted, the /user/:uid , /user/:uid/anything-else , /user/login or /...
Marius Ilie's user avatar
  • 3,072
1 vote
1 answer
41 views

admin user interface language is changed to another user's preferred language

I have a weird situation. I as an admin have the preferred language set to English and I want to edit another user that has a preferred language set to something different (French for example). When I ...
Marius Ilie's user avatar
  • 3,072
0 votes
2 answers
94 views

How can I programmatically update an exposed filter? [closed]

I am trying to apply an exposed filter programmatically. If filter 'a' is set to 'apple' I want to set filter 'b' to 'green'. Using this code updates the filter. If a user sets the drop-down filter 'a'...
Saml's user avatar
  • 1
0 votes
0 answers
44 views

How can I programmatically get the node title? [duplicate]

A drupal newbie here. I'm looking to build an "issues navigator", a custom block displaying a menu. I'd like to set the "current issue" automatically, from the title of the node ...
Victor Pudeyev's user avatar
0 votes
0 answers
84 views

Getting existing composer managed site to legacy-project composer managed

[Update] I seem to be making some actual progress by just replacing the the composer.json with https://github.com/drupal/legacy-project/blob/8.9.x/composer.json and then doing a composer require [all ...
Chris Rockwell's user avatar
1 vote
2 answers
93 views

Can I populate a select form element with options in separate file?

I have a text file which is a list of 100s of rows. Which I am trying to turn in to a select list. I have created a module, in mymodule/src/form/mymoduleform.php. I am trying to load the items from ...
David's user avatar
  • 21
1 vote
1 answer
43 views

Search API autocomplete view mode template

I got search api autocomplete setup and using the live results feature I was able to set it to use my Search Autocomplete view mode. I am trying to figure out what the twig template name would be. Any ...
Ronnie's user avatar
  • 477
0 votes
0 answers
64 views

Migrating content from production to development

I have a multilingual site built on the Glazed Drupal CMS installation profile (Drupal 8). It was upgraded to Drupal 9, but the upgrading process lasted around 3 months, and now new content from the ...
Alex Sh's user avatar
  • 11
0 votes
1 answer
165 views

Programmatically saving data in a field under user account

QR codes have been printed out for a bunch of students in a university. When they visit the site via those QR codes, and they are logged-in, the refcode query parameter used in the link needs to be ...
Maher B's user avatar
0 votes
0 answers
117 views

Query to order by specific item to be first and then to sort the rest with id desc

I am into a unique requirement where I need to sort records to show specific data first and then rest sort by id descending. I am able to see records using SELECT * FROM jobs where type='jobs' and ...
Tejas Damre's user avatar
0 votes
1 answer
63 views

How to save a customer profile to address book in Drupal Commerce using JSON:API

In the commerce order checkout page, if you use "Save to my address book" checkbox in the billing address section, the address is getting saved to the user's address book. But if I am doing ...
Farhan Erooth's user avatar
0 votes
1 answer
71 views

Programmatically remove duplicated nodes without changing the number of nodes shown per page

I have a content type called Página de área (Area page) referenced by two content type: Article and Agrupador. I have a view that displays all the Article nodes that share at least one area with an ...
Jordi Bustos's user avatar
0 votes
0 answers
24 views

Views posts not displaying correctly until clearing the cache

I have an issue with a Drupal 8 website. I have some pages that have views listing some contents ( text and images). The websites uses CDN and varnish. The problem is that sometimes, the contents like ...
el sparrow's user avatar
0 votes
0 answers
25 views

search api views, sort by most viewed?

I have a view of content. I have enabled the statistics module and in the view I can add Sort: Statistics: Total Views. I am now trying to make a similar view page but using search api. Have enabled ...
May 's user avatar
  • 163
0 votes
0 answers
37 views

How to move add button above listing for inline entity form

We're using Inline Entity Form for a project and we have a bunch nested content types. For one of those content types, we want the add button to be above the listing of existing entities of that type ....
agodin's user avatar
  • 93
2 votes
0 answers
43 views

How to group taxonomy terms by depth in views?

my example taxonomy looks like this: - fruit -- apple -- orange -- banana - vegetable -- carrot -- cabbage i want to render a page in views that groups level 1 terms by their parent term, The ...
Tomáš Bažant's user avatar
0 votes
1 answer
469 views

How to get value from object in twig template file? [duplicate]

I can print the result object by {{ dump(item.value['#result']) }} in theme item-list--search-results.html.twig template file. I want to print the body field value("body"=>"value&...
Ramalingam Perumal's user avatar
1 vote
1 answer
851 views

Why does the error 'You have requested a non-existent parameter "site.path"' occur on module configure buttons?

When I click some configuration buttons for example in layout builder UI or the following buttons. I get the following error in admin/reports/dblog Symfony\Component\DependencyInjection\Exception\...
Jordi Bustos's user avatar
1 vote
0 answers
210 views

Content moderation and changing node state on default or latest revision

I am using content moderation and sometimes I update the moderation state of my entity programmatically in a hook node presave for example. I usually have the entity and I can do $node->set('...
arirams's user avatar
  • 11
-3 votes
1 answer
310 views

Get MenuLinkContent object values [closed]

get title and link of a menu link object in. I am trying to get title and link of a MenuLinkContent object and below is my code. I want to get title and link value. How I can get the title and Link ...
New Dev's user avatar
0 votes
0 answers
112 views

Trying to sort rows by a column in views twig template

I'm trying to sort the rows of a view in the table template but can't figure out how to sort by a particular column. I can only get it to sort by the first column. I'm trying to sort a views global ...
davidp's user avatar
  • 1
0 votes
0 answers
36 views

Trying to sort a views result by a global views conditional field

I'm attempting to use hook_views_pre_render in a Drupal 8.9.20 site to sort the results of a view by a global views conditional field and I could really use some help. I've spent some hours searching ...
davidp's user avatar
  • 1
0 votes
2 answers
285 views

How to check if webform has a draft submission?

I'm using hook_webform_submission_form_alter() to prepopulate some form values. When a user saves a draft of their webform submission and comes back to it later, the code in ...
codesmith's user avatar
  • 280
1 vote
1 answer
202 views

How to check for content type in hook_form_alter

I see from the api and various posts that I can identify a specific form to change using hook_form_alter, like this: hook_form_FORM_ID_alter() From experience, I know this can be done in the .theme ...
aharown07's user avatar
  • 362
1 vote
1 answer
20 views

List of fields to put on a REST call

I have a rest resource configured from Rest UI page (let's say /entity/user: POST); I would like to share the endpoint with others devs so they can call the API (create users for e.g.). Where to get ...
Notd's user avatar
  • 43
0 votes
1 answer
113 views

Run custom php code or file in drupal content type form submission

I have this drupal site, there is a candidate registration page where anyone can fill the details (name, gender, address, mobile no etc) and submits and a success node page is displayed with all ...
user3099225's user avatar
0 votes
0 answers
30 views

How do I link to a Views Page from a systemAdminMenuBlockPage page?

I have a custom module that I have a systemAdminMenuBlockPage in that I'd like to link to various content administration Views pages from. I basically have a custom Configuration menu item doing this ...
River Liver's user avatar
0 votes
1 answer
81 views

ReCaptcha doesn't show on Simplenews Subscription Block

I have the subscription form of Simplenews in the footer, which should be protected with reCaptcha. I installed reCaptcha and created a captcha point with the form ID of the Simplenews block. ...
Zeroplexer's user avatar
0 votes
1 answer
103 views

How can I add a button to every row of custom column?

I have created a custom column in the content listing section using hook_views_data(). I want to add a button to the every row of that custom column. Can anyone help me with this issue? function ...
Manav Chauhan's user avatar
0 votes
0 answers
33 views

Views: How to filter content by taxonomy terms that are not selected?

I have a view of a specific content type that can be filtered by two different taxonomies A and B. Some nodes that have the taxonomy term A1 also have the term B5. Now when I filter only by the term ...
0711master's user avatar
0 votes
1 answer
172 views

How to use a Controller method inside a service with dependency injection?

I'm using the diff module for a project, this module has a method inside a Controller that I want to use in a service to reuse code. As this time I'm just calling the method like ...
Adrian Cid Almaguer's user avatar
0 votes
0 answers
55 views

How to import config to a site installed with a profile?

Good day. I’ve installed a profile, made my settings, entered my content, exported config and pushed everything to the repo. Now, when I clone it somewhere else and attempt to install using the config,...
Kartagis's user avatar
  • 612
2 votes
0 answers
193 views

Why doesn't the entity access handler I wrote work when the entity is referenced?

I have set a handler for the access of my entity but when I reference it in another entity, the access is not checked. I want the reference and the entity to have the same access check. Any idea ? The ...
CWolf18's user avatar
  • 21
0 votes
1 answer
214 views

AliasManagerInterface -deprecated Drupal\Core\Path\AliasManagerInterface

Error: The website encountered an unexpected error. Please try again later. TypeError: Argument passed to Drupal{module name}\Theme{class name}::__construct() must implement interface Drupal\...
sudhan's user avatar
  • 11
1 vote
0 answers
1k views

Argument 2 passed to Symfony\Component\Routing\RouteCollection::add() must be an instance of Symfony\Component\Routing\Route, boolean given

Ubuntu 18.04.6 Apache2, Postgresql 10, Drupal 8.9.6, PHP 7.2.34 (most of the modules require these versions) I've tried trouble shooting this problem for multiple weeks. I'm attempting to migrate a ...
Nategamer's user avatar
-1 votes
2 answers
963 views

How to get Webform Element value into Custom Token

How to assign a value of Webform Element (IP_ADDRESS) to a Custom Token ? The Step that I did: use Drupal\webform\WebformSubmissionInterface; function MODULE_token_info() { // token info } function ...
3zz's user avatar
  • 128
0 votes
0 answers
59 views

How to determine entity where image field is housed?

I need to check if an image media field is housed in a paragraph to remove the alt attribute of that attribute. The same image field could be referenced anywhere. I could remove the alt field it ...
Binny's user avatar
  • 886
0 votes
0 answers
1k views

PluginNotFoundException entity type does not exist when trying to uninstall any module

I've got this drupal website from a client that the another developer created, and they've made a mess with many things in this site. I'm having a problem where every time I try to uninstall a module, ...
Jean da Silva's user avatar
0 votes
1 answer
82 views

How can I attach a newly added paragraph to existing records? [closed]

While editing a form, I needed to delete some fields and add a new paragraph. The issue here is, the newly added paragraph is not initialized in the edit form and that makes sense because the old data ...
Mourad Tlili's user avatar
0 votes
1 answer
223 views

How do I restrict content access programmatically?

Something is baffling me. I have this view of streams to users. An admin may make a stream to themselves, a specific person or everyone. I also have this code in which a non-admin user may see only ...
Kartagis's user avatar
  • 612
0 votes
0 answers
136 views

how to get field image of a referenced entity in paragraph template

I made a paragraph with a referenced entity field to a content type called "tools" Actually I can get the title and body text like that : <h3>{{ content.field_tools_and_services.0['#...
johndoe555's user avatar
1 vote
0 answers
49 views

Count how often a route is called

I have written a custom module that exports nodes in different formats. The module itself works great but now I would to count how often one of the custom routes is called. The desired route in the ...
stopopol's user avatar
  • 141
0 votes
1 answer
378 views

How to get menu Attributes from a theme's preprocess function?

I am developing a theme and trying to send custom vars to a twig menu template (since it pulls data from config) and have a loop to add variables in preprocess: foreach($attributes as $attribute => ...
adam_bear's user avatar
  • 293
2 votes
0 answers
216 views

Field formatter with twig editor in settings form

I've created Drupal 9 module with custom field formatter for many field types (string, entity_reference, image etc). I'm trying to implement twig editor in the formatter to control output. I need to ...
Nikita Melnik's user avatar
0 votes
0 answers
34 views

What could cause these fields to be reverted to unsortable?

I've been working on this view for some time. I've 5 page and 5 block displays and have a table in each. I click the table settings, sort every field that needs to be sorted, then save the view, ...
Kartagis's user avatar
  • 612
2 votes
1 answer
536 views

How can I make route parameters optional in a routing callback?

I needed to create a route in which the path of the route would be completely dynamic and so I created a routing callback. <?php namespace Drupal\uber_affiliate\Routing; use Symfony\Component\...
Binny's user avatar
  • 886
0 votes
0 answers
19 views

How do I insert the corresponding text content from source into email based on selection?

I have run into a wall trying to find a solution to this problem and am hopeful someone here may have some feedback or ideas. (I'm on Drupal 8 btw) A department in my organization wants a form with a ...
testing12345's user avatar
0 votes
1 answer
53 views

Can a template file write, copy, or rename files? [closed]

Can code put in a template file write, copy, rename files, or read files that aren't template files?

1
2 3 4 5
316