All Questions

7
votes
1answer
3k views

How to implement a multi step approval with webforms/entityforms based on form components?

Is it possible to invoke multi-step submission workflow using either Webform or Entityform? Here is the scenario of workflows: An employee submits the form Superviser gets notification,...
6
votes
7answers
7k views

How to replace the search submit button with a Font Awesome character?

I would like to replace the search submit button with a Font Awesome character like the Magnifier (Search Icon) character, and put Search the site inside the search box. How can I achieve something ...
2
votes
3answers
4k views

What is easiest way to debug variables in nodes, views, blocks and page twig templates?

What is easiest way to debug variables in nodes,views,blocks and page template. Earlier we used devel module in drupal 7 ,by using dpm() function it shows very neat and clean structure ,it was so ...
4
votes
2answers
10k views

how to create rules to send email notification for node reference content?

I have two content types: job posting and job application. The job application content type has a node reference field for job posting. Whenever users create a job posting node, other users can send ...
4
votes
6answers
11k views

How do I insert a <span> </span> tag inside the <a> </a> tag on my main menu

I have asked exactly this question on Stack Overflow, but it makes more sense to ask it here. I'm trying to make the text between my tag not display by wrapping it in a and then styling that. I've ...
3
votes
2answers
2k views

Tagging a friend in a node

Is it possible to create the functionality where, on creating a node, the user can tag friends to associate their friend with the node. Such as in Facebook's tag a friend in a post. This would ...
3
votes
2answers
5k views

How to show the count of members that belong to a group?

I have a view showing a list of nodes of type group. How do I set it up to show the count of members that belong to each group?
2
votes
2answers
4k views

How to safely render node body on a custom variable?

I created a custom template for my programmatically created block. I defined a variable for the template called test so in my render array I have '#test' => $node->get('body')->value ...
9
votes
4answers
13k views

How to define Meta tags on Views? [closed]

Is there any module or some configuration that I can define the meta tags for the views page display in drupal 7 using Views 3.0?
9
votes
3answers
9k views

Can I use ajax to target multiple form elements from one input?

I'm trying to use ajax to update two different parts of a drupal form from just one form input blur. I have the standard ajax stuff on my input: $my_form['my_input']['#ajax'] = array( 'callback' =&...
8
votes
2answers
4k views

Problem with event subscriber - KernelEvents::REQUEST is not fired on cached pages

I am trying to implement a KernelEvents::REQUEST event subscriber to perform some action on page load. I need this event to fire regardless of whether the requested page exists in the Drupal cache - ...
5
votes
2answers
6k views

Add content type field programmatically

My module provides a configuration form which allows to select a content type and on submit 2 new fields will be added to the selected content types. I want to add these fields to the content types ...
4
votes
1answer
7k views

How to load and display a view with Ajax in Drupal 7?

This is the first time I've ever tried to load a view using Ajax in Drupal7 and I would be appreciated if you help me from scratch. I've spent hours to learn how to do this but I still failed! I ...
1
vote
1answer
3k views

How can I display a picture from a field as the user picture rather than the drupal default with user-picture.tpl.php?

Because my site requires user pictures to be approved, the default Drupal user picture is not suitable. Instead, I want to show a picture from a field in each user's profile as the user's profile ...
1
vote
2answers
1k views

How to render specific form elements from the *.theme file

I am using Drupal 8 and would like to customize how form elements are being displayed. Specifically, I don't like how uneditable, populated textfields are displayed as plain text. I would have it ...
0
votes
1answer
333 views

How to show authorized users a link for relevant Views results using the Rules Link module?

Assume a list of entities, created by the Views module. For example a list of "All blocked/active users" which looks like so: User name Active Created date Last login Hillary.Trump No ...
18
votes
5answers
8k views

How to Filter view by comparing 2 fields. If field-a < field-b

I have a product content type that has 2 price fields. I want to create a view that shows all products where price-A is less than price-B. I was hoping I could just add a filter and select price-A ...
11
votes
4answers
8k views

How to configure an exposed filter in a view using a date picker?

How can I configure an exposed filter so that users can filter my site content by creation date, preferably using a date picker? I tried using Content: Authored on as filter, but it gets me a text ...
8
votes
3answers
8k views

Listing entity fields

I wonder if there is a good, and easy way to get all fields of an entity. I have a taxonomy vocabulary. Its terms have a special field I want to make list in a select box in one of my modules, so ...
4
votes
0answers
814 views

How do I suppress a warning or error message for site users? [duplicate]

file_unmanaged_copy() drupal_set_message() on certain conditions. Even with visible errors messages disabled, anonymous users see this. Indeed, the comment in the code even has a TODO to change it to ...
4
votes
2answers
7k views

Adding a class to “body”

I'm trying to add a custom CSS class to the <body> tag, How can I modify or pre-process the <body> tag to add the class body, Is it right to style the <body> tag with css file?
2
votes
2answers
2k views

How to force a redirect (override the destination query string in the URL)

I have a custom form submit callback to redirect users to a specific page: function MYMODULE_authfrontpageredirect_callback(array &$form, FormStateInterface &$form_state) { $url = \Drupal::...
1
vote
2answers
577 views

How to concatenate all token values of a list in a single field within a Rules loop?

I am attempting to send a list of uploaded files on a newly created node via email. In a content type, I have a File Field that allows unlimited values. Within Rules, I created a loop calling the ...
1
vote
2answers
4k views

drupal /?q=user is working but /user not working

I have recently moved my files from dev server to test server. same setting and db of dev server were copied to test server. In dev server all is working fine but when I have am checking in test sever ...
0
votes
3answers
717 views

How can I set a reminder for a specific user to be triggered on a specific date?

How can I set a reminder for a specific user to be triggered on a specific date (in a Drupal 7 site)? Example: I want to remind the user regarding particular event such as hepB vaccination day. Any ...
80
votes
7answers
8k views

Suggestions for settings.php - Local dev, Development server, Live server

Basically, one of the greatest questions of all time: What are some ways you're using settings.php in your development/staging workflow? Right now, I have my settings.php file set up like the ...
15
votes
2answers
6k views

Need a simple Google Maps solution; lost in the labyrinth of modules

First of all, let me just state that I don't care which version of Drupal I'd have to use (6 or 7). I have experience with both versions I just didn't need to work with Google Maps till now. The ...
29
votes
2answers
23k views

How to create test_endpoint?

I am new to drupal and I am using services module for using REST and RESTWS module. I used RESTWS and could get the content of the node by http://base_url/node/1.xml and now I need to add a node ...
72
votes
8answers
9k views

How can I obscure what I am using to run my site?

Is there anything I can do to prevent somebody from knowing my site is using Drupal by looking at the source code of the front page? I am referring to people who scan sites using software that detects ...
36
votes
4answers
20k views

What is the template suggestion for node 'teaser' view mode?

node--[type|nodeid].tpl.php targets to node's default view mode. However I want to override the template for teaser view mode. What is the template suggestion (.tpl.php file) for 'teaser' view mode?
40
votes
11answers
24k views

Which tables are safe to clear?

I have inherited a client site that has an extremely large database for no reason. There is a moderate amount of content and very little enabled modules. However, the database is too large for moving ...
34
votes
9answers
5k views

What's a good balance between reusing fields versus creating new ones in the context of fields scalability?

I've read the following phrase on a website: Instead of adding new fields to a content type, adding existing fields is a better option to reduce the system’s complexity and to improve scalability. ...
19
votes
3answers
8k views

How does the batch API work internally?

I ran into a timeout issue using migrate the other day and started to wonder how the Batch API works internally. The way I understand it is that in its simplest form you'll pass an array of values (...
19
votes
4answers
12k views

Programmatically creating an order in Drupal Commerce for anonymous users redirecting to payment page

Ryan has some great code that you can programmatically create an order <?php global $user; $product_id = 1; // Create the new order in checkout; you might also check first to // see if your user ...
47
votes
4answers
63k views

How do I get the current node ID?

In Drupal 7, if I wanted to get to get the node id of the currently displayed node (e.g. node/145) I could get it with the arg() function. In this case, arg(1) would return 145. How can I achieve the ...
18
votes
6answers
7k views

View of users flagged by a user, users flagging a user, and nodes from users flagged by a user

I have a user flag that is pretty much like a "follow" or "subscribe" function. Basically I want to create 3 views for my website's user profile pages: A list of users flagged by a user (e.g. a ...
51
votes
3answers
32k views

How to upgrade only core with drush?

There's a huge security leak in <7.32. So I want to upgrade all my Drupal sites asap without too much worrying about breaking stuff. But... $ drush dl drupal-7.32 It's forbidden to download ...
12
votes
1answer
14k views

How to set Media Styles in Media 7.1.2 / Media 7.2.X?

Where is the latest form of the component in the Media project family that allows styles to be defined for Media files? I see a lot of references to the idea that the Media module contains, once ...
62
votes
5answers
45k views

What does “The provided host name is not valid for this server” mean?

I am running a Drupal 8 website, and when I browse to any page, I get a plain white page with just the following error message on it. The provided host name is not valid for this server. What does ...
48
votes
9answers
57k views

Where does Drupal store the content of a node's body?

In the node table, you'll find everything except the actual body. Where can I find this body text? I'm assuming it's being stored as a blob somewhere.
23
votes
4answers
22k views

Get the actual query executed by a view

I need to find out the SQL query that is executed by a certain query. Views module can show the SQL when configuring the view but apparently the query is not the actual query that gets run in all ...
30
votes
3answers
36k views

Count results in Views using aggregation

Is it possible to count results (e.g. count the nodes of the content type x) in a view, using aggregation (not programmatically)?
25
votes
5answers
21k views

preprocess function per content type

I have a couple of content types which I need to preprocess in different ways. So template.php in my theme foo currently looks like: function foo_preprocess_node(&$variables) { if ('news' ==$...
30
votes
17answers
30k views

How to delete all nodes of a given content type?

I have several thousand nodes of a particular content type. Using the web interface (example.com/admin/content), I can only delete about 50 at a time. How can I quickly delete them?
20
votes
3answers
15k views

specify $form elements to be excluded from display?

I want to hide certain elements in form using form_alter or a template file. I have read somewhere that in Drupal 7 , we can specify $form elements so it will not display in form, but I can't remember!...
19
votes
2answers
964 views

How to use the Features module in a 3 dev environnement?

Working on a project, making heavy use of Features, there is sometimes 3 devs for this application. We have tried a few approaches, but when we merge our git branches it seems we often 'over-write'...
18
votes
4answers
7k views

How to combine views exposed filter with search?

My client asked me for a single field, that would work 2 ways: Autocomplete filter based on taxonomy. If site visitor inputs something that's not in taxonomy, full text search should be performed on ...
14
votes
2answers
4k views

How do I set my views to return a 404 using Global: Null under contextual filters?

Standard Drupal behavior is to pass all arguments through, whether or not they requested. Sometimes this behavior is desired. However, I need to return a 404 for anything but a query string. Example ...
12
votes
3answers
17k views

Page template suggestions are not working

I've created a theme and have my template files in this structure /templates/page/page.tpl.php /templates/page/page--node-type.tpl.php I've created a custom page template but for some reason it's ...
26
votes
8answers
48k views

How to programmatically get the NID of the current node

I've pored over this old thread on drupal.org and it just kind of makes my head spin around. Pulling down the path and trying to parse out the NID from within it? There has to be a better way. And ...

15 30 50 per page