All Questions
24,064
questions with no upvoted or accepted answers
15
votes
0answers
1k views
How do I setup Chained fast backend, Varnish, APCu and Redis cache bins in settings.php?
On a Debian Jessie server (Nginx, PHP 5.6, Zend Opcache), I installed Apcu, Redis, Varnish. I also installed APCu, Chained fast backend, Redis and Varnish modules.
In order to make these caching ...
12
votes
0answers
2k views
How do I translate theme settings?
How do you translate custom theme settings in Drupal 8?
I use hook_form_system_theme_settings_alter to add custom settings to a theme. One setting is the text string (e.g. 'Menu') to display beside ...
10
votes
6answers
2k views
How do I allow a free product into a cart, but only if cart net value is above $10?
I'm interested in running a promotion ...
I'd like to make a product free if the customer's cart total is $10.
I was able to do that with this module: http://drupal.org/project/uc_discounts_alt
...
9
votes
2answers
1k views
Custom view sorting plugin / handler
I am trying to create a custom sorting option for view that will sort result on the basis of percentage of 2 fields.
field 1 = node__field_funding_amount
field 2 = node__field_funding_goal
and i am ...
9
votes
0answers
548 views
How do I go about migrating books using MIgrate_D2D?
I've had to rebuild my sites recently due to a hit on the Drupalgeddon bug I thought I closed. I've been trying to migrate everything in easily but it doesn't seem to want to for whatever reason.
Now,...
9
votes
3answers
1k views
LIKE clause not working in hook query alter
I'm trying to replace the default search with a LIKE clause in Drupal 7. I tried to alter the query according to Adding an OR condition to an existing query:
function MYMODULE_query_node_access_alter(...
9
votes
1answer
902 views
With search_api_solr, how can I apply an significant field based boost when using solr 6.x?
I am using the solr backend for search_api on a drupal 8 site.
I have added the value of a taxonomy term reference field (field_promoted_search) to the index.
If an item of content has ...
8
votes
3answers
3k views
How can I hide the entity ID on an autocomplete widget?
I have an autocomplete widget for a taxonomy entity reference.
Every term shows its entity ID between parentheses; plus, if the term name contains spaces, it appears between quotes, e.g. "Lorem ...
8
votes
1answer
400 views
Is it possible to migrate data into multiple translations of entities?
I'm running a multilingual migration of events (which are stored as nodes) that have keywords on them where there are keywords (stored as terms). The keywords should be stored in a multilingual tags ...
8
votes
2answers
3k views
How to set required POST parameters for routes
With GET method we can do something like this
example.user
path: 'example/{user}'
defaults:
_controller: '\Drupal\example\Controller\ExampleController::content'
requirements:
...
8
votes
1answer
578 views
Grouped Exposed filters radio buttons : one in two no value ticked. How to programatically force default button be ticked?
Some exposed filters (radio buttons) aren't systematically ticked when a view is displayed, causing an "An illegal choice has been detected. Please contact admin..." error message and No result found. ...
8
votes
1answer
2k views
How to set up Authcache module with Varnish and ESI?
I am trying to set up Drupal 7 with Authcache beta 2 and Varnish 3.0 but I can't get the ESI blocks working. Varnish it self seems to work well.
I am using the example.vcl from sites/all/modules/...
8
votes
3answers
1k views
How to use URL parameter and page callbacks for tab menus correctly?
I'm using Drupal 6 and I'm trying to display two tab (menus) on a page that has the URL /vehicle_info.
Both pages that the tabs link to should take a node's nid as parameter.
My current code looks as ...
7
votes
2answers
474 views
Big pipe and behaviors context
I have problem with drupal behaviors and context in combination with big pipe. It seems like context variable sometimes contains same part of page. I have tried:
(function ($, Drupal) {
Drupal....
7
votes
0answers
624 views
How do I make an archived-dump of my site?
I have multiple versions of drush and cannot make an archive-dump of my site.
drush8 ard/drush8 archive-dump returns
[error] The drush command 'ard' (and/or 'archive-dump') could not be found. ...
7
votes
2answers
2k views
Creating date field with only month and year
We are using the Form API in a custom module (and not an entity field), how can we easily set the date widget for just year and month data entry?
I've tried adding a #date_format attribute but no ...
7
votes
2answers
2k views
How do I enable the “print PDF” link on only a specific page?
I have enabled the print module and configured the basic page content type to show a PDF print link under the basic page settings.
On the print module's Links settings page at admin/config/user-...
7
votes
0answers
145 views
Splitting Atom categories into two fields
I am using Feeds to import an Atom feed into my site. The feed has categories as
<category term="cat:Foo" scheme="http://www.sixapart.com/ns/types#category" />
<category term="tag:foo" ...
7
votes
2answers
2k views
Reasons for subsequent Broken/missing handler in Views?
In the process of upgrading Drupal 6.x to 7.x I'm facing a problem that makes all my views show nothing relevant. (I believe the problem is here but I'm not sure, I don't know. That's why I'm asking):
...
7
votes
1answer
482 views
Order list: Pay unpaid invoices
I have created some extra statuses: Paid and Unpaid.
Now they got the functionality and react on the transaction balance perfectly fine. However, on the user site, it is kind of a dumb thing.
Even ...
7
votes
1answer
2k views
Disabling Browse to Library in Media Upload Field
I'm on d7.2 with the included Media Module. I'm also using WYSIWYG if that matters at all.
I'm seeing that when a user clicks the image upload field, they have a choice of either 'web' or 'library'. ...
7
votes
2answers
2k views
How to setup event registration and paypal payment?
We have events and we take registrations for them. Entity Registration module is installed for that purpose and it's working great. Now, since those events are paid events, we want to implement PayPal ...
6
votes
1answer
2k views
How can I allow users to specify image dimensions in CKEditor
I have a use case where content editors have a requirement to specify the height and the width of an image in the image properties. Sticking to styles is not possible because $reasons.
The CKEditor ...
6
votes
0answers
1k views
How do I theme a modal popup?
How can I style Drupal 8 modal window to achieve Instagram style and behaviour?
I'm creating modal through extending ControllerBase class, thus have full control of content. However I can't figure it ...
6
votes
1answer
2k views
Add Expression for Entity Query
I've been working with the entityQuery to query the db and get an array of filtered nids however I need to add an expression to my query.
I've checked the Query class and found a protected sqlQuery ...
6
votes
2answers
485 views
Managing custom aliases on translated content
We have a Drupal 8 site with translated content, and using the Pathauto module. The issue we are running into is that when we un-check the "Generate automatic URL alias" on, say, the Chinese node, ...
6
votes
1answer
1k views
Configuration changes that will not import?
I have some configuration that will not import. If I run drush config-import --preview I see the changes to be imported; I hit 'y' to import. When I run the same command, the changes are still there?
...
6
votes
1answer
1k views
Change views exposed filter format
I am build a JSON export using a View in Drupal 8. Problem is that the parameters for retrieving the json doesn't seem to work as I would want.
In my View I need use two exposed filter criteria to ...
6
votes
2answers
2k views
Passing dates or date ranges into a view as arguments
Drupal 7, Views and Date modules installed.
I have a view on a content type with a date field (timestamp, but I can change it if necessary)
When I use it in filter criteria, I have no problem to use ...
6
votes
1answer
154 views
Update core keeping other composer packages
After upgrading Drupal to the last version with Drush (8.1.15) the other composer.json dependencies (e.g. drupalconsole) are removed.
Are there any way to update Drupal with Drush keeping other ...
6
votes
4answers
3k views
Tableselect with dropdown per row
I use a tableselect to output a list of terms and per row I want a drop down (select):
$header = array(
'name' => array('data' => t('Name')),
'weight' => array('data' => t('...
5
votes
1answer
54 views
How do I include composer.libraries.json in root composer.json without using the wikimedia/composer-merge-plugin plugin?
In the recent update to Composer 2.0 the advice is to get rid of the wikimedia/composer-merge-plugin, which was even removed from the dependencies of Drupal core.
There is documentation on how to ...
5
votes
0answers
78 views
How can I write a unit test for a custom field formatter?
I'm working on a project where we need to have code coverage using phpunit.
I have a public method that includes this code:
/**
* {@inheritdoc}
*/
public function viewElements(...
5
votes
0answers
381 views
Set SameSite=strict for session cookies
I'm trying to figure out how to set the SameSite cookie attribute for Drupal 8 session cookies, but I can't find a solution.
I thought SessionConfiguration might give me enough options, but it seems ...
5
votes
1answer
102 views
Benefit of config entities over regular config entries?
In Drupal 8 it is possible to store configuration in "config entities".
However, the same can also be achieved with non-entity config entries.
E.g. one example for a config entity schema, from core....
5
votes
1answer
1k views
Manipulating Theme Suggestion Priorities
I'm adding in some theme suggestions using mytheme_theme_suggestions_alter(), when certain criteria is met. My issue is, for some reason these additional theme suggestions are appearing at the top of ...
5
votes
2answers
894 views
Send mail notification when node of given type gets created
Use case: a small site where I want to warn all users by mail whenever a new content of a particular type is created. I thought I would try Rules+Actions to handle this.
I'm working on a vanilla ...
5
votes
0answers
1k views
How to create a Draft view with Content Moderation?
In Drupal 7 with Workbench Moderation is easy to create a view to show the last Draft of a content:
You have a relation in the view named Workbench Moderation: Node, so using the filter Workbench ...
5
votes
2answers
1k views
How to programmatically add content to a group in the Group Module?
I'm using the Group module. If I have a group type such as Project, and I have a content type such as Article, and I programmatically created a new article node using Node::create(), how can I in the ...
5
votes
3answers
2k views
How do I define a computed field equal to the concatenation of two fields of my custom entity?
I have a custom entity (Person) with these fields: ID, nom, prenom, telephoneportable, estactive, userID, created, changed. I created it with baseFieldDefinitions.
I want to have a computed field ...
5
votes
1answer
1k views
How to add multiple products to cart at the same time with attributes
I have different view blocks that display multiple products on the same page, each product has their own attributes such as product bundle and custom line item, these serves as an option set / ...
5
votes
1answer
7k views
How to create a “read more” button using AJAX in a module?
I'm working on a really simple module in Drupal 8 to get the hang of things. What it does (or rather, what the page I'm asking about in this question does) is grab some data of a bunch of simple ...
5
votes
1answer
461 views
Automated login with LDAP always returns error
I have successfully setup LDAP module to authenticate users (and create new users). This is done through manual login form. Now I'm trying to enable automated single sign-on, but with no luck.
I ...
5
votes
1answer
127 views
Programmatically Setting Content Ranking Factors For Drupal Search
I've added a dropdown to Drupal search page interface. I would like for users to be able to select this control to sort results according to Date or Keyword Relevance.
I'm able to get the dropdown ...
5
votes
1answer
324 views
Search filter result score
I'm seeing an interesting anomaly (?) I'm trying to get to the bottom of. I've set up a view with an exposed filter Search: Search Terms. I am trying to mimic the result set offered by standard drupal ...
5
votes
1answer
839 views
Using multiple AND/OR operators in contextual filters
I'm trying to query my nodes by using a contextual filter in views, however, I am unable to use multiple AND (+) operators and OR (-) operators at the same time. For example:
This works:
mysite.com/...
5
votes
2answers
1k views
How do I display empty fields?
I have redesigned the layout of the page using the display suite module. When I go to the node, I see empty fields are not there. I like to see the empty fields on the node. I have been looking for ...
5
votes
1answer
610 views
Drupal Commerce causing database deadlocks
I'm trying to get to the bottom of a known Drupal Commerce bug to do with row locking.
When a user logs in on my development site, Drupal Commerce starts multiple identical queries that look like ...
5
votes
0answers
553 views
What is the use of Drupal.settings.ajaxPageState object?
I am working on a Drupal site on which a functionality breaks because the value of Drupal.settings.ajaxPageState.js gets reset to an empty array instead of an object containing the list of js files.
...
5
votes
1answer
2k views
jquery date picker in views exposed filter changes the date values
I have a node type "tasks" and created a view so that current logged in user can see his/her assigned tasks. I have used a "time ago" formatter in the field "deadline" which shows the remaining time ...