All Questions

54
votes
6answers
31k views

How can I automatically upload images on file selection rather than pressing the upload button?

I have a custom content type to allow users to upload images. I'm trying to keep the interface as simple as possible. The content type contains a single image field. This works, but some users don'...
58
votes
6answers
85k views

How do I create custom regions in a theme?

I want to add a new area which will be site wide. Describe the process of getting this new region into my theme, if possible generalize it for adding any new, custom region.
46
votes
3answers
28k views

How to provide template for particular view mode?

I want to theme the search result view mode with a template. I had it in my head that naming a template file node--article--search-result.tpl.php would do the trick, but I'm obviously wrong about ...
20
votes
12answers
33k views

I've got `PDOException: SQLSTATE[HY000] [2002] No such file or directory` when using drush [closed]

I installed Drush for the first time (so it may be a configuration error) and I'm trying to update to the latest core version of Drupal. Drush is giving me this error - I'm on an OSX box. dev5:...
15
votes
5answers
17k views

Changing url of exposed filter

When I used an exposed filter the filter selection is passed as name/value pair in the url, for example: members?field_a=valuea&field_b=valueb How can I set it up to use more of a "pathauto" ...
18
votes
5answers
47k views

How do I simply make the whole site use a secure connection?

In Drupal 7, I used the Secure login module to run the site on a secure connection, but it seems it doesn't revert back to http on logout. I would like to just run the whole site as https:// as a ...
15
votes
3answers
32k views

Add a custom submission handler to a form

How can I add a custom form submission handler? I tried adding $form['#submit'][] = 'mymodule_form_submit'; or $form['actions']['submit']['#submit'][] = 'mymodule_form_submit'; to hook_form_alter(). ...
10
votes
7answers
22k views

User login REST format

Do anyone have a working REST Login on Drupal 8? This is what I tried. POST /user/login HTTP/1.1 Host: 8.d8.local Content-Type: application/x-www-form-urlencoded Accept-Encoding: http://nikhilmohan....
2
votes
3answers
1k views

How to specify a Rules condition related to select list values?

I'm now thoroughly confused about trying to set a Rules Condition on a select list. There are two things I want to do: (a) On a new node of my content type I want to trigger when a certain checkbox ...
78
votes
14answers
50k views

Any way to add CSS for a single page/node?

I'm cleaning up my big crazy style sheets (possibly pertinent to a future question) and I'm wondering the best way to add custom CSS to a specific node or page. In particular, my work site's home ...
46
votes
3answers
18k views

How to migrate from test environment to production environment?

The migration is from the local environment to the production environment. The production environment has run some time and created a lot of articles. In order to add new things to my site, I added ...
31
votes
9answers
43k views

How do I remove duplicates when using the random sort?

I have created a view where I am displaying the the node title and a logo (a cck field). In the arguments I have passed the taxonomy term name. In the result a node is displaying 2 or 3 times; I ...
23
votes
4answers
6k views

Clean way of building simple taxonomy browser of arbitrary depth

I have spent days trying to determine a clean way to do the following: Display a list of all top-level terms in a vocabulary with links to their child terms Upon clicking a link, be taken to a list ...
20
votes
1answer
65k views

Strict warning: Only variables should be passed by reference

I get the following error: Strict warning: Only variables should be passed by reference in include() (line 18 of /home/sites/dev/theparce/sites/all/themes/parce/block--block--3.tpl.php). This is ...
7
votes
3answers
13k views

Resolve the error “An illegal choice has been detected…”

I have written code like below and all works fine, but while submitting the form I get the error below. I am trying to filter the second dropdown based on the first drop down selection. An illegal ...
2
votes
1answer
1k views

How to bulk assign existing content to a group created with the Group module?

The Group module is an alternative for Organic Groups. One of the features it offers is that you can assign nodes to a Group. Question: how to bulk-assign a set of existing nodes to a specific group, ...
1
vote
1answer
164 views

Which Rules condition can be used to email a user when an admin updates their profile?

I am trying to set up a rule (using the Rules module) that will email a user if their user record has been updated by an admin. It is easy to generate an email when their profile is updated, but I ...
47
votes
5answers
63k views

How do I get the node ID from the URL?

So far, I came across these 3 functions in Drupal 7, but I am not really sure what the difference between them is, and which is more appropriated to get the node ID in a block preprocess function. ...
71
votes
4answers
67k views

How do I load a field collection from a node?

I have a node that has a few field collections on it. When I look at node_load() output, I see: [field_rich_text_group] => Array ( [und] => Array ( ...
48
votes
17answers
125k views

Configuring the temporary directory

I have recently moved a site from a localhost to a VPS. I have managed to make the public and private files writable; however, I am not sure where to find the temporary folder and how to change the ...
58
votes
8answers
67k views

Rebuild images from image style

I have an image style in Drupal 7. I attached several images to a nodes and display the images based on this style. I then changed the effects on this image style but the existing images are not being ...
45
votes
5answers
35k views

Create a user programmatically and give they a role

I'm creating a user programmatically like this: $newUser = array( 'name' => $mail, 'pass' => 'password', // note: do not md5 the password 'mail' => $mail, 'status' => 1, '...
20
votes
5answers
33k views

Get Image URL in Twig

I want to render an image as a background image via an inline style in twig. I created a field called bg_image and attached it to the standard plain page. After fiddling around for hours I was able ...
19
votes
9answers
43k views

Create template file for views block

There is a lot about theming custom blocks, but what about blocks created by views? My views block has id: block-views-posts-listing-block, I try many ways for naming template file, ex: block--block-...
23
votes
5answers
26k views

Show forms in a modal window [closed]

I have a form and I am using Drupal 7. I need to show this form in a popup when a user clicks a link. The user should then be able to complete the form whilst in the pop up window. I can use anything ...
21
votes
3answers
15k views

How do I create a multisite with shared users and nodes?

I want to create a multisite with Drupal 7: Every site works separately but users, and nodes must be shared among the sites. How do I achieve it?
13
votes
3answers
27k views

How to show the parent and child taxonomy term?

I have a vocabulary like this: Parent 1 Child 1 Child 2 Child 3 Parent 2 Child 1 Child 2 Now I would like to use a view to create a list of a Parent term with its Child terms. I try to do this ...
13
votes
1answer
5k views

What are the most appropriate users and permission levels for Drupal sites on shared hosting?

Although the Drupal site goes into great detail about permissions and security, there are only vague/unclear references to shared hosting. From a Drupal point of view, what is the most secure set-up (...
10
votes
3answers
7k views

How do I convert a database from MyISAM to InnoDB?

I am going to convert all the tables of 500MB database from MyISAM to InnoDB to see whether it will improve the overall performance of a busy Drupal 6 site. I am wondering what is the best (i.e. ...
8
votes
5answers
8k views

How to embed drupal content in other sites (remove X-Frame-Options: SAMEORIGIN)?

I tried to make a iframe with a drupal page but I received the following message: Multiple "Refused to display (page adress) in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'." Then, I ...
10
votes
1answer
6k views

drush/drush dev-master requires codegyre/robo ~1.0.0-beta1

I'm transitioning a Drupal 6 site to Drupal 8.1 so following the official instructions, I set up a new install in its own directory. Since this is only one site, I followed the instructions to put my ...
2
votes
6answers
2k views

Is there a simple way to notify users about new posts on the site?

I want my users to be able to "subscribe" to new content that is posted on my site. I've looked at the Notifications and Subscriptions modules and they are just massive! I've also looked at ...
2
votes
2answers
649 views

How to implement a follow author (or user) function? [closed]

Is it possible to implement a Follow button for authors of posts in Drupal 7, so that users can: Follow any one they wish, and Be notified about the new posts of those authors. This sounds like '...
22
votes
10answers
5k views

Can I turn cache off for the development deployment?

On development platform caching can be a pain. Can I turn it off? Will it affect any of the modules that require it?
11
votes
6answers
11k views

How do I programmatically place a block?

From UI you can add a block in a region in that way: Go to Admin -> Structure -> Block layout (/admin/structure/block). Click on "Place block" button besides the region name. I want to do the ...
10
votes
2answers
23k views

How do I theme a webform? [closed]

I am in need to theme webform in D7. How can I do that ? In the search I've come to know that by using web-form-nid.tpl.php we are able to theme a drupal individual form. Could any one guide me in ...
2
votes
1answer
375 views

Memory Exhausted after Drush install [duplicate]

I've made a drush install of drupal 7.28 on my AWS server. I can confirm that the memory is set to 128M, all green on the reports -> site status page. The website will function normally and ...
2
votes
1answer
81 views

How to integrate messaging into a custom module?

I'm working on a custom module to handle time off requests for an intranet site and I'd like to be able to have the module fire off email notifications to a configurable list of users -- specifically, ...
1
vote
1answer
340 views

How to show message view containing own and following activity?

I have created a message view using the Message module. I want this view to show the current user activity and activity of the user he is following using the "follow" flag (user). i.e own + following. ...
83
votes
7answers
16k views

When is it appropriate to create an Entity versus just adding a new content type?

What is the benefit to creating new entity types over just building a new content type? It seems a bit overkill to do all of the custom coding that is required to create a new entity when you have ...
59
votes
5answers
61k views

Print the query which is built using db_select()

I want to print the query which is built using db_select() in a programmatical way. Is there any API function provided by Drupal Abstraction Layer? It is similar to query output in Views, but I want ...
51
votes
2answers
36k views

Better understanding of Drupal behaviors

I read about Drupal behaviors today, and I tried writing the following code. (function ($) { Drupal.behaviors.mymodule = { attach: function (context, settings) { $('#mymodule_id', ...
40
votes
9answers
28k views

Count of nodes by type

I am looking for a snippet that lets me display the total count for a specific node type, e.g. "Pages = 167" or "Products = 10630." What code should I use to achieve this?
55
votes
8answers
47k views

How to programmatically create Fields?

How can I approach implementing the following in Drupal 7? What I need to do is create a module which defines a new fieldable entity, called 'Company'. I have a list of, let's say, 20 fields that ...
49
votes
8answers
80k views

How do I get the current path alias or path?

How can I get the current alias and/or path in Drupal 8? In Drupal 7 I did this with drupal_get_path_alias(). What is the equivalent code I should use in Drupal 8?
16
votes
1answer
3k views

How to effectively manage a site with Drush make?

What things are important to consider when managing a site using Drush make?
25
votes
10answers
47k views

How do I create a link?

Say I am extending The blockBase class to create a custom block, and I am implementing the blockBuild method to create some markup for my block. Something like this: class YourModuleBlock extends ...
36
votes
3answers
55k views

Adding CSS and JS to form with attachments

I need to add some external and local CSS and JavaScript files to a form, but I can't seem to find the right way to do this. Do I simply add the paths and URLs for the JS and CSS files? I assume $...
21
votes
7answers
55k views

How do I clear cache using an SQL query?

After a module update, my site has become unusable, and only shows a php error message. I tried circumventing the problem with drush cc, but that didn't help. Also tried with a custom php script but ...
14
votes
5answers
5k views

What is the correct composer based core update workflow?

I want to use composer to manage Drupal 8 dependencies, but I'm not sure what is the right core update workflow. At the moment I'm using drush to update core to latest beta release, but I also have ...

15 30 50 per page