All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
542 views

Hide block on specific page through custom contextual link

We usually require to hide some blocks on specific pages for which we need to goto configure block page and add the URL of the page where we do not want to display a block. Instead of going to ...
2 votes
1 answer
1k views

Alter Exposed filter form

I would like to know how to get parent terms only, for example "Ages 0-2" and also print in dropdown. This is the structure of the form array. Array( [#info] => Array( [filter-tid] => ...
0 votes
0 answers
9 views

When I try to migrate, the wrong migration plugins are used

I'm trying to migrate a Drupal 6 site to Drupal 9. The problem is that when I try to run the migration I get a lot of errors as if Drupal try to use the Drupal 7 migration plugins instead of the ...
0 votes
1 answer
455 views

How to programatically change file user owner

I'm using the Services module. I can upload files through web services, but the problem is that all the created files have the same owner, the user account used for the web services. I would like to ...
0 votes
0 answers
11 views

View only your own comments, no one else's?

I have a client who would like users to be able to comment on content without being able to see any other users' comments. This is for a review system where users shouldn't feel influenced by the ...
1 vote
1 answer
1k views

Solr index fields not showing a field

I have a field within a field collection that I need indexed. It's not showing up in the /admin/config/search/search_api/index/solr_node_index/fields page. I tried using this to try to add it myself, ...
1 vote
2 answers
38 views
+50

refresh form_token with refresh page

Unfortunately, the form_token does not change when I refresh the form pages. Doesn't this cause abuse and security risks? Can anyone explain what Drupal does for CSRF in all its forms? Thanks
1 vote
1 answer
2k views

jQuery dialog is duplicated when set on a form that uses AJAX

Im using jQuery dialog on my form. Drupal.behaviors.custom = { attach: function (context, settings) { $('.form-container').once('form-cont', function () { Drupal.custom.modalLinks(); })...
2 votes
2 answers
1k views

How can I apply different templates based on taxonomy hierarchy?

I'm new to Drupal and I don't have extensive knowledge so I'm hoping I can get this question answered. I want the taxonomy pages of lower hierarchy to be displayed differently from the higher by ...
0 votes
3 answers
1k views

CSS changes not taking effect in customized styles folder

I am trying to size the banner in a Jackson theme on my site to fit to the 960px wrapper size have in customized folder in sites/all/themes/mytheme/styles/mytheme.css but no matter what I do the ...
0 votes
2 answers
933 views

Loading a form from a form include file in a module

I have an external form that needs to be loaded inside a template file, used by a block. Right now, i'm a bit confused as to how to load this .inc. Looking at the API docs point to module_load_include(...
0 votes
1 answer
1k views

How do I check radio buttons in Twig template?

In a form, I have this field: $form['payment'] = [ '#type' => 'radios', '#title' => $this->t('Payment Mode'), '#options' => [ 'chk' => $this->t('by check'), 'tfr' =&...
3 votes
3 answers
7k views

Breadcrumb/block settings

Should Views (that are setup as a Page) be able to inherit breadcrumbs/block visibility settings? When I create a Views page, set a path, add it to the menu (then adjust it to be a sub-menu of another ...
2 votes
1 answer
606 views

How to import multi-value fields into profile2 using the Migrate module

I have users each with a profile using the profile2 module. I am using a cookbook based on the Migrate framework to create the users and import profile data. Sample CSV data would be: "member_nr","...
0 votes
2 answers
1k views

Ajax error on node form edit page

I'm trying to ajaxify part of node form. I have a hook_form_alter that adds extra ajax property to a widget of select field. The problem I'm facing is the callback method / function, which is not ...
0 votes
1 answer
1k views

Migration Source YML File import date string into date and time field of content type

I have a json file full of data exported from a wordpress site, one field being a string representing a date and time: "03/15/2012 14:46:19". I would like to import that string into a date and time ...
0 votes
1 answer
25 views

How can I update the node date for all nodes

I have imported a number of nodes to a fresh installed Drupal 9. Later, the original content creation date (from the previous website) became important. I have the information according to the new ...
0 votes
0 answers
38 views

Status messages don't show

I have a controller that manages a password reset form submit. Everything works fine, except for setting messages. I've tried to alter the message in the .module file too with no luck. It worked on ...
4 votes
1 answer
747 views

How to implement StackMiddleware for a redirection correctly?

I'm working on a redirection (for unauthenticated users) for my Drupal 8 site. Currently, the redirection works however, the redirection persists even after user is authenticated. I found this article ...
0 votes
0 answers
17 views

How to remove a sort in hook_views_query_alter

I've got a search API search view that has two sorts on it. relevance and then published date. This means that when I do a text search the relevancy score handles the sorting, but when there is no ...
1 vote
2 answers
1k views

How to set default form fields value from controller

How to setup default form fields value from a form created in a controller? I tryed to set the $form_state param but it does not work. ... $form_state = new FormState(); $form_state->set('...
0 votes
1 answer
346 views

Hiding menu item depending on specific access

I work on a D8 (8.6) I want to hide some item on my menu depending on route param onto this link. When I try to access the route I get a 403 error and works as expected but the the link inside the ...
4 votes
2 answers
4k views

Programmatically modifying global custom text field in view

I have a (Apache solr) view with a Global: Custom text field in addition to my normal fields. This field is meant to get value from a custom function/existing field/passing an existing field to a ...
0 votes
1 answer
377 views

Generic orders URL

Is there a way to create a page that requires the user to log in and then shows them all their orders, but only the orders of the logged in user. I need it to the same URL for all users as an external ...
0 votes
0 answers
29 views

Status: 500 Internal Server Error

I run /path/to/drush/drush status from the shell just fine, but if I run it from a script called from cron I get this error. Status: 500 Internal Server Error Content-type: text/html; charset=UTF-8 ...
0 votes
1 answer
849 views

Date field Start and End limit

When we create a date field in node form, we can set START and END years to be shown in that date field. If we are creating a date field programatcaly, how do we do that? I have a date field, my_date,...
22 votes
6 answers
27k views

Check if the user is logged-in in a theme

In Drupal 7 we can simply check if the current user is logged-in in a theme by checking $GLOBAL['user']->uid or using user_is_logged_in(). How can I check if a user is logged-in in a page ...
1 vote
1 answer
405 views

Paragraph type can't delete individual items

I use Paragraph module Version: 8.x-1.5. Somehow I can't delete individual items anymore? Is there a settings somewhere I missed?
2 votes
2 answers
656 views

Reference View in Entity Reference field

I have a content type that has an entity reference field allowing you to link to other pages and add a custom image, for nice big CTAs. However, it's come to light that some of the links may need to ...
0 votes
1 answer
347 views

Disabling Twig cache does not prevent Drupal from caching

I have the following content in menu.html.twig template. <ul> <li><a href="/">Blog</a></li> <li><a href="/photos">Bilder</a></li> &...
0 votes
1 answer
42 views

hook_form_alter() to add placeholder to a text field via custom module

It should be very straightforward and yet, I can't identify the reason why this doesn't add a placeholder to a field in a form: function posts_form_alter(&$form, FormStateInterface $form_state, $...
0 votes
2 answers
433 views

Node is not created, but nid is returned

I have this code in my module. $node = new stdClass(); $node->title = "YOUR TITLE"; $node->type = "page"; node_object_prepare($node); $node->language = 'it'; $node->uid = 1; ...
2 votes
2 answers
587 views

Assign a node to an organic group

Programmatically assign a node to an organic group is following my previous question which I have found the solution for Drupal 7, but I am now looking for the same issue in Drupal 6. How can I ...
0 votes
1 answer
932 views

How do I get a URL variable in a template?

I am trying to include a certain .html file if the URL has ?work=1. So far I have this, which I got from Check URL for string in a Twig file. {% if 'work' in url %} {{ include('work/index.html'...
3 votes
1 answer
1k views

Why does cloning a private git repository via Drush make file fail using SSH authentication?

I have multiple private git accounts set up with SSH system's keychain authentication for each git repo. It works to clone private git repos from command line: git clone git@git_ssh_alias:git-...
1 vote
1 answer
30 views

How do I upcast route parameters for entity_revision?

My custom entity is revisionable. I can see revisions, but my revision revert form doesn't work. The route for the form is definited in msul_rovi_games.routing.yml. entity.rovi_game....
1 vote
1 answer
382 views

See all nodes where user profile entity reference matches the same entity reference on the node

I have the Profile 2 module where a user selects a zip code (which is an entity reference to the content type ZipCode) The ZipCode content type has an entity reference to a Region content type. ...
0 votes
0 answers
14 views

How do I get coupons usage in a view

There is no field for the number of times the coupon was used in Add fields when creating a new view. while other related fields such as Usage limit are available, according to database check: The ...
0 votes
1 answer
536 views

Authentication cookie in a load balanced environment

Hopefully this is a basic question. I'm going to be setting up a drupal website there there will be multiple servers in back of a load balancer. The user will hit one web server where they will ...
1 vote
1 answer
680 views

How do I say to Twig where to look for the template files?

I want to add another path where the templates are stored. In standard PHP I'd use $loader->addPath('../path/to/templates'). I found Twig_Loader_Filesystem::addPath(), but I have no clue where and ...
3 votes
1 answer
112 views

How to get the field name in a validation handler?

I have a custom class TextWidget extends WidgetBase Inside it I have a custom validation handler that looks like this: public function validate($element, FormStateInterface $form_state) { $value = $...
4 votes
2 answers
1k views

How to select files from /sites/default/files with IMCE filebrowser?

Somehow the settings of directories in the configuration of IMCE (7.x-1.7) is pointing to <root>/. which lets met start in the private_files directory but not in the (public) files directory. I ...
3 votes
2 answers
396 views

How to add html tags to account setting emails?

I am working on a project where I need to add some custom headers to the email which we send to the user on registration. Is there a module which support this functionality?
1 vote
1 answer
496 views

Theme settings to include different PHP files into template

I'm trying to include a template section into another template under conditions based on the themes settings. page.tpl.php <header> <?php $theme_header_style = theme_get_setting('...
2 votes
1 answer
651 views

Create commerce product through web services

I want to create products using commerce services resource module. At this moment, I can create a product calling the resource .../product with POST, but It seems that It only creates a product ...
1 vote
1 answer
1k views

Reload page after applying commerce coupon

I'm quite obsessed on one page checkout using drupal commerce kickstart. I'm using commerce coupon(wonderful module) and we all know that there's a possibility that the order total price could be zero ...
1 vote
1 answer
396 views

How can I programmatically remove the file from a managed_file form element?

I have a form where users upload images. When an image is submitted it is validated against various criteria. If the validation fails the user is returned to the form but the failed file is still ...
0 votes
0 answers
27 views

I lose template suggestions when an ajax event is called

I'm generating theme suggestions based on the formdazzle module, I made my own variant because I needed another level of granularity of theme names and it works fine. Well, in the alter hook I have ...
2 votes
2 answers
974 views

Loading a queue?

How can I use Drush to pass data into a Drupal Queue? function hook_cron_queue_info() { $queues['my_queue_name'] = array( 'worker callback' => '_my_queue_callback', // This is the callback ...
3 votes
2 answers
849 views

How can I import special characters using Feeds?

I am using the Feeds module to import data into my site from a CSV file. When I try to import a row that has the € character, nothing gets imported and I get an error message. error:General error: ...

15 30 50 per page
1
2 3 4 5
1721