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
1
vote
0
answers
17
views
How do I decide where to put these fields in a Commerce License architecture?
I'm creating a License Type using Commerce License. It will allow a user that owns a group to purchase seats on that group for other users. Therefore, at purchase time, I need to associate a group ...
3
votes
2
answers
2k
views
"RuntimeException: You have requested a non-existent parameter 'app.root'"
After I clear the cache, I get this message.
Symfony\Component\DependencyInjection\Exception\RuntimeException: You have requested a non-existent parameter "app.root". in Symfony\Component\...
0
votes
1
answer
322
views
How update a webform submitted value clicking in a button?
How can I update a submitted data just clicking in a button? I have created a View table of webform subissions and I would like to add a collumn with a button "Aprroval". When user click on ...
0
votes
1
answer
235
views
Change product price title in form
How can I access the label of the product price field to change it for example to "amount" instead of "price"?
The html for the field is:
<div class="js-form-item form-item ...
0
votes
1
answer
127
views
How can I remove PDF download button?
I am using the pdf_reader module and showing my PDF on the node. Now, I am supposed to hide the download button. For this purpose, I wrote the below javascript file:
jQuery(document).ready(function($) ...
0
votes
1
answer
608
views
How to stop cron process without rebooting my server?
I have tried the following:
drush php-eval "\Drupal::lock()->release('cron');"
This had no effect. I'm still seeing "Attempting to re-run cron" errors pile up in the log.
I ...
3
votes
2
answers
1k
views
How to re-index all content for the core search engine?
Is there a way to re-index all content for the core search engine?
In older versions, you could reindex with drush:
drush search-reindex --immediate --verbose
However, this does not appear to be an ...
0
votes
1
answer
59
views
Does the "Search keywords" exposed filter depend on the core search index?
If I create an exposed Search keywords filter for a view, does this functionality depend on the core search engine? Do I need to index the site at admin/config/search/pages for a Search keywords ...
0
votes
1
answer
38
views
Hide active term from the term page
I have an article content type that has a taxonomy reference field that stores the author name. It can hold multiple authors in case the article is authored by more than one author.
As per the image ...
1
vote
1
answer
553
views
Use AJAX not working when view is rendered programmatically
I have a view that is being rendered like this
$view = Views::getView('view_id');
$view->setDisplay('block_1');
$view->execute();
$render = $view->render();
$html = \Drupal::service('...
0
votes
0
answers
53
views
No more access to user login
The URL mysite.com/user/login redirects to home page, so that I've lost access to administration.
I tried mysite.com/?q=user/login. Sadly, same redirection. :-(
Has anyone encountered this probleme or ...
0
votes
0
answers
51
views
Right way to print logged in user custom fields [duplicate]
What is the right way to get the field value for the account used from the currently logged-in user and print it in a template file, for example a block or a page template file?
I was trying to use ...
0
votes
2
answers
122
views
How can I alter the login form in the login block but not in the login page?
How should I use hook_form_alter() to modify the user login block but not the user login form page? Everything I've tried either modifies both entities or doesn't work, not even using the following ...
0
votes
0
answers
56
views
Mock user with fields to use in a functional test
How is it possible to mock a user with some simple text fields (for example, First name and Last name) in a functional test (which extends BrowserTestBase) without creating the configuration for this ...
1
vote
1
answer
42
views
Bibcite: How to sort publications by last name of first author?
Bibcite module: I have a view which shows all publications and I'm using the citation field. But every publication is shown as many time as many authors it has. When I'm using aggregation (count ...
0
votes
2
answers
407
views
How to extend core block class SystemBrandingBlock
Please advice how we can extend the core block class Drupal\system\Plugin\Block\SystemBrandingBlock to add custom method.
In my case, I want to include function buildToArray() to get the block data in ...
0
votes
1
answer
1k
views
ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY'
When importing a dump from a production site with mysql in a xampp environment I got this error:
ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY'
These lines are affected:
ALTER TABLE `...
0
votes
0
answers
220
views
Getting InvalidArgumentException for UpgradeStatusForm after installing the upgrade_status module on a Drupal 8 site
I have a very old install that began with 6 and is now at 8. I'm trying to get it updated to 9 but have gotten stuck with getting the upgrade_status module to work. After it was installed via composer,...
0
votes
1
answer
58
views
Primary tabs display differently for different roles?
In my Drupal 8 site (using the Seven theme), the primary tabs navigation are displaying differently for different roles. See screenshots below.
It would appear that for the limited Editor role, it's ...
1
vote
0
answers
53
views
Programmatically load the same view multiple times with different contextual filters values
I'm trying to load a view X times but with a different contextual filter value each time. My code generates the correct amount of view blocks, but they are all the exact same. They all correspond to ...
0
votes
0
answers
210
views
The use of contexts in a Drupal.t() function in Javascript
According to the documentation, we can use contexts with Drupal.t() since Drupal 8.
Drupal.t('May', {}, {context: "Long month name"}); works fine, but Drupal.t('May', {}, {context: "...
1
vote
0
answers
64
views
Search: Do not index some parts of HTML
We're indexing the rendered HTML output (rendered_item, type "Fulltext") of pages into elasticsearch using elasticsearch_connector.
Some parts of the HTML shall not be indexed because they ...
0
votes
0
answers
76
views
Twig templates with lots of classes?
I have created a twig template and have added classes like below.
{%
set title-classes = [
'title',
'h1',
]
%}
{%
set subtitle-classes = [
'subtitle',
'h2',
]
%}
<div{{ ...
0
votes
0
answers
62
views
How can I filter based on unique taxonomy term values?
I have a content type "book". One of its field "field_language" referencing to "language" taxonomy term. field_language can have only one value.
Consider this is the ...
0
votes
1
answer
60
views
Node reference field autocomplete and allow multiple selections in views
I recently pdated my Drupal core to 8.9 and suddenly a functionality stops working.
I have a "Recipe" content type, it has a field of "Category" (field_category) which is Entity ...
0
votes
1
answer
88
views
Where are path aliases stored?
I know that, in Drupal 7, path aliases are stored in the url_alias table. Which database table does Drupal 8 use to store path aliases?
0
votes
2
answers
225
views
Why do some Drush commands only run from docroot?
Wondering if anyone knows why some Drush commands (with file parameters) only run from the docroot and won't run from the project/composer root?
Commands such as drush sql-query and drush locale-...
0
votes
1
answer
239
views
Loading a field value within a twig template
I'm building a multi-country website using Drupal 8. The company would like to have each region manage their website independently but still have a "global" site. I'm building a theme which ...
0
votes
1
answer
67
views
Middle part of a page disappears and appears again after flushing all caches
Sometimes middle part of some page at our website may disappear and only header and footer are still displayed. The problem is always solved after flushing all caches.
Our html.html.twig loads ...
1
vote
0
answers
435
views
Restrict a Media field to allow selecting only a certain file extension in an existing Media Type
Is there a way to restrict a Media field using an existing Media Type (File) in a Content Type to permit only a certain file extension in that instance?
In particular, I need a subset of the permitted ...
1
vote
1
answer
54
views
Error when trying to view revisions
Using Drupal 8/9. When trying to view previous revisions I am getting the following error:
Error: Call to a member function getType() on string in clc_d8_theme_theme_suggestions_page_alter() (line 13 ...
0
votes
2
answers
370
views
How to cache View block by content language?
I have a very simple (block) view to list a node's title. This view has an id from url contextual filter and a single filter to filter on Content language set for the page (by URL prefix). This block ...
0
votes
0
answers
242
views
How to set an encrypted file field's value programmatically
I'm trying to set an encrypted file field's value programmatically. I'm using Encrypted Files module. I have successfully configured a file field, and it works for the contents created using the node ...
2
votes
1
answer
250
views
Safely save data to the order in onNotify()
I'm new to Drupal and have to make an off-site payment gateway (with Drupal Commerce 2). It all works, but sometimes it doesn't.
The remote payment provider's server sends notification requests to the ...
0
votes
1
answer
221
views
Managed file in theme config not saving
In my theme settings under 'admin/appearance/settings/mytheme' I am trying to add an image field.
I have added the following to mytheme.theme
function mytheme_form_system_theme_settings_alter(&$...
-1
votes
1
answer
144
views
Get the value of Entity reference revisions field in order email twig file
I want to get the entity reference field value in order email.
Name of the entity reference is field_price_value and called paragraph field is field_price now I want to get the field price value
I ...
0
votes
0
answers
59
views
How can I make a white screen of death less ugly
A project I'm working on requires custom modules, and I'll be the last person to claim that I am perfect. I've gone through and removed as many possible php errors and causes for WSODs that I can ...
3
votes
1
answer
142
views
Custom AJAX Response not firing on Flag action
I'm trying to run custom javascript functions at the same time as people interact with certain flags on my site, I have followed this tutorial on how to respond to both Flag/Unflag actions, and this ...
2
votes
0
answers
140
views
Disable the "Add Link" button in entity.menu.edit_form for certain roles
I'd like to hide the "Add Link" button in menu.edit_form for certain roles.
Running dpm($form) for this form I can't find that button in there.
In core there is menu_ui.links.action.yml with ...
0
votes
1
answer
116
views
Is it possible to render a region in a menu template?
In my Drupal 8 theme I have a template called __menu.html.twig which gets called in my page.html.twig
I am trying to render a region within the __menu.html.twig where I can place blocks.
I have ...
0
votes
1
answer
49
views
How can I print view/edit/comment links? [closed]
I have a view that uses the "View content," "edit content," and "view comments" fields. I can't figure out how to print these in a custom twig template.
I've tried:
{{ ...
0
votes
1
answer
22
views
Add a second RulesAction to a custom module
I created a custom module containing one Rules Action that works perfectly. I tried adding a second by creating a second php file in the MODULE/src/Plugin/RulesAction folder, with the names and class ...
0
votes
1
answer
254
views
Send email to author when content is published through scheduler
I have used Scheduler module with content moderation integration to publish a content automatically. It is perfectly working using the module. Now I want to add a functionality that once the content ...
0
votes
1
answer
828
views
how to convert date into timestamp using timezone
I am using strtotime to convert date into time stamp but its does not work correctly. I know its relatively to time zone. My drupal store time zone is denver. I am not sure why its not showing correct ...
0
votes
0
answers
339
views
Better exposed filter for block view doesn't appear
I created a new content type and a display page to show a listing of all my new content type pages. I'm trying to create a better exposed filter block on my page for the sidebar, but when I try to add ...
1
vote
1
answer
459
views
How can I force user logout from a JavaScript library in a custom module?
I've written a custom module for Drupal 8 to monitor user device location frequently. If a user goes out of an allowed zone boundary, I need to force logging the user out of the website. I created ...
0
votes
0
answers
46
views
Custom breadcrumb navigation, but url link shows page node
I'm pretty new to Drupal and I'm creating a new content type. The site uses custom breadcrumbs built using BreadcrumbBuilderInterface for certain content types which was built before my time. I'm not ...
1
vote
1
answer
119
views
How to exclude taxes from total prices but still show the tax during checkout
So I create a tax type Custom and set the rate 18%. The checkbox Display taxes of this type inclusive in product prices. comes in checked by default. If I leave it like that, cart shows product price ...
1
vote
1
answer
142
views
Unable to use SameSite=none with secure attribute, using Symfony\Component\HttpFoundation\Cookie to create the cookie
I am trying to create a cookie in Drupal 8.9 with SameSite=none with secure attribute, using the Symfony\Component\HttpFoundation\Cookie class but I am unable to do so as the class doesn't allow the ...
0
votes
0
answers
168
views
How can I conditionally display fields based on the same paragraph radio field value?
I have added a paragraph where I want to use a radio button to conditionally display text fields from that same paragraph.
My radio values are:
Select discount in amount -> if checked, then ...