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.
15,791
questions
0
votes
2
answers
48
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'...
0
votes
0
answers
29
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 ...
-3
votes
0
answers
27
views
How can I change the search button to use the Fontawesome search icon?
I am running drupal 8.5.0 and have a search bar. I want to change the Search button and use a fontawesome search button. I have installed fontawesome Version: 8.x-2.14, its corresponding libraries in ...
0
votes
0
answers
43
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 ...
1
vote
2
answers
81
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 ...
1
vote
1
answer
25
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 ...
0
votes
0
answers
47
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 ...
0
votes
1
answer
114
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 ...
0
votes
0
answers
72
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 ...
0
votes
1
answer
51
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 ...
0
votes
1
answer
62
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 ...
0
votes
0
answers
21
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 ...
0
votes
0
answers
21
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 ...
0
votes
0
answers
32
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 ....
2
votes
0
answers
42
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 ...
0
votes
1
answer
335
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&...
1
vote
1
answer
574
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\...
1
vote
0
answers
143
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('...
-2
votes
1
answer
212
views
Get MenuLinkContent object values
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 ...
0
votes
0
answers
90
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 ...
0
votes
0
answers
30
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 ...
0
votes
2
answers
207
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 ...
1
vote
1
answer
138
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 ...
1
vote
1
answer
18
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 ...
0
votes
1
answer
96
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 ...
0
votes
0
answers
29
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 ...
0
votes
1
answer
71
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. ...
0
votes
1
answer
76
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 ...
0
votes
0
answers
26
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 ...
0
votes
1
answer
119
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 ...
0
votes
0
answers
50
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,...
2
votes
0
answers
164
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 ...
0
votes
1
answer
175
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\...
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 ...
-1
votes
2
answers
838
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 ...
0
votes
0
answers
57
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 ...
0
votes
0
answers
878
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, ...
0
votes
1
answer
79
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 ...
0
votes
1
answer
172
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 ...
0
votes
0
answers
118
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['#...
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 ...
0
votes
1
answer
349
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 => ...
0
votes
0
answers
27
views
How do I show sets of questions based on the value of another field?
I am trying to create a registration webform based on the type of program students are registering for. For example if students have options to select ( School A, School B, School C, etc.) I would ...
0
votes
0
answers
45
views
How to apply Views bulk operations on nodes related with layout builder settings?
I have a number of nodes of a particular content type with Layout Builder enabled. Layout Builder has an option to revert to the default for each node of a content type. How can we expose this ...
2
votes
0
answers
204
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 ...
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, ...
2
votes
1
answer
498
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\...
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 ...
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
vote
0
answers
275
views
How do I solve "RouteNotFoundException: Route "jsonapi.settings" does not exist" which occurs while installing the REST UI module? [closed]
When I am trying to install or uninstall a module the below error shows up.
The same error is displayed when I go to webservices (Home > Admin > Configuration > Web Services).
The website ...