Hooks are PHP functions used to interact with the Drupal API.

learn more… | top users | synonyms (1)

0
votes
1answer
13 views

hook_preprocess_views_view not loading view when records are empty

I am trying to add some css and js files using the hook_preprocess_views_view_unformatted Hook in template.php Here is my code : function mytheme_preprocess_views_view_unformatted(&$vars) { ...
0
votes
1answer
31 views

How do I remove “active” css class from breadcrumbs?

I am trying to include Structured Data in my breadcrumbs. The google validator throws an error on my final breadcrumb. When I remove class="active" from the code in the code validator window the code ...
0
votes
0answers
13 views

Drupal views aggregation with multiple relationship

I need to create a single view that gets information from multiple entities to have a sum value. This means having to use multiple relationships. The issue that i am having is that multiple ...
1
vote
3answers
87 views

How to programmatically set node alias on node save

I need to set a special path alias for nodes created by users in the template.php file of my theme. the pathauto module is enabled. I already tried the solutions that are given in the following links ...
1
vote
1answer
16 views

hook_menu drupal 7 shows in menu but not show page

I made module, and want to add settings page. Menu Item appear in settings dashboard, but when try access page it display dashboard with menu items again, thought URL is correct. return array( ...
0
votes
1answer
16 views

Module admin configuration permission

I have a custom module, saidbakr_tools and I want to apply permissions to access its administration page found admin/config/administration/saidbakr_tools. All what I have to got from the official ...
0
votes
1answer
16 views

Getting a list of altered fields when saving a node

I need to trigger some logic to recalculate certain computed fields based on what fields may have been altered when a user updates a node. So I'm looking to create a function that returns a list of of ...
0
votes
1answer
13 views

Drupal 7, hook permission for view published content only for certain content type/blog

I disabled the view published permission for anonymous user. but I wanted to allow anonymous user to view the blog section with views on it, and I cant seem to hook permission on that particular blog. ...
0
votes
1answer
45 views

How to attach a module to a drupal article? [closed]

I have a php function in a drupal module. This function outputs some random text. I want to attach this module to a Drupal article so that each time someone creates an article, random text will appear ...
0
votes
1answer
38 views

Which hook to use on initial creation of a node?

I would like to execute a script once a new piece of content of a specific type has been created, but not updated. Which hook would I use for this? I basically want to execute a script that will ...
0
votes
1answer
33 views

MODULE_preprocess_block() get rendered region in drupal 8

So I am trying to port a Drupal 7 module to Drupal 8, and am struggling with how to translate a "NAME_preprocess_block" method. In the D7 code, it filters by the region a block is getting rendered ...
0
votes
1answer
26 views

Hook menu - title arguments

I have those menu elements declared in hook_menu function: $items['submission/%/id/%'] = array( 'title' => 'View submission', 'title callback' => 'fr_form_view_submission_page_title', ...
1
vote
0answers
42 views

Custom visibility settings not applying

I'm trying to edit a module. It has per role visibility settings that work, but i added code to add per page visibility settings. The settings show in the module ui page but they don't save(they don't ...
0
votes
1answer
26 views

image_style_url() function not giving proper image in drupal 7

I am using image_style_url() function in drupal 7 with custom style. In my custom style I have taken a height:200 and width:200. But its cropping my image with these style not re-sizing it. ...
1
vote
0answers
13 views

Hook into scheduler to delete node from nodequeue on unpublish

I'm working on Drupal 6 site and trying to solve the following issue. If scheduler unpublishes a node, it should be deleted from all nodequeues it's in. currently I'm looking for hooking into the ...
1
vote
0answers
28 views

Hook for altering a view table

Is there a hook function for altering a table that is generated by views? I have a field in the table that shouldn't be seen when another field is set/contains content. I'm using Drupal 7
0
votes
0answers
16 views

How to setup custom header, before Apache throws 404?

We have design custom module, if NODE doesn't exist in the DB then archive content will be served through XML file and render the result in article template. Before rendering a template and serving ...
4
votes
1answer
69 views

Multiple url aliasses per node in multi language website

Hope this is the right place for this question. I'm turning to you guys because I just cannot decide on the best way to go for this issue. I'm currently developing a multi-language site which is ...
1
vote
1answer
36 views

How to use node reference to link images of referenced node?

I created a blog content type. In this content type I added a field "blog detail". I have a custom module to fetch data using node_load() in blog page. Now I want, when I click on a particular image, ...
0
votes
1answer
19 views

Error in hook menu

I have used drupal 7.38.I have created a custom hook_menu function(). My code is: function jasmine_custom_menu(){ $items = array(); $items['review'] = array( 'title' => 'Review Page', ...
0
votes
0answers
49 views

Drupal 7 Modal login form throws AJAX HTTP error

I am working on a custom module that will allow remote authentication via an API if a user attempting to log in is not an administrator. The module first does a hook_form_alter and in that function ...
0
votes
2answers
20 views

How to add call a js file in custom module that are added in libraries folder in drupal 7?

I am creating a custom module in drupal 7 and adding a js file in sites/all/libraries folder but its not working.Please check my code function mymodule_library(){ $libraries['mymodule'] = array( ...
0
votes
1answer
35 views

access $node in form breaks ajax call

I built a custom form that works well, however I updated my custom module to create a custom content type and add the form via hook_node_view(). Everything works, until I access the $node object in ...
1
vote
1answer
19 views

Set image format of field_view_field image field

I'm using a function to place an image from a user field into nodes that the user creates. The display is set to thumbnail in default, user account and tokens, but it shows up as original in the node. ...
0
votes
2answers
12 views

Add html5 placeholders to node_add inputs

I'd like to add placeholders to node_add field inputs. I'm trying to use dpm($form) but am not sure where to put it. I couldn't get node-add.tpl to work with this function MYTHEME_theme() { ...
1
vote
0answers
30 views

How to set (import) oembed's ctools exportable settings as defaults for the module programmatically?

Oembed provides defaults for some providers (e.g. youtube, twitter etc) out of the box. It also provides the ability to export each provider's settings through the UI. I have added a new URL pattern ...
-2
votes
0answers
14 views

How to put image under div in hook_field_formatter_view in drupal 7? [duplicate]

I am using this code in my custom module .. This is not showing image only showing div. function mymod_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { ...
0
votes
1answer
20 views

How to add metatag module data to the Search API indexes

I am in the process of building a new site that will have some content in the form of videos and PDFs. To make those more searchable I added the metatag module. We are also using the Search API to ...
0
votes
1answer
13 views

Getting the field of a user based on uid or name

I'm trying to display some custom user fields of an author, of a content type's nodes. The only fields in $node that relate to the author seem to be $node->name and $node->uid. I tried this in ...
0
votes
1answer
39 views

how to add wrapper div for a image via image formatter in drupal 7?

I am creating custom formatter for images using hook_field_formatter_settings_form() in drupal 7.. I need to add wrapper div for my custom formatter. Means when I select this formatter then image ...
0
votes
0answers
10 views

Add a new country to location module in drupal 6

I need to add a new country to location module country list. I do not want to do it by changing in database. I can see there is a hook for the same in D7. <?php function ...
2
votes
1answer
41 views

hook_form_alter based on path

I don't know if this is possible but could I do something like <?php $foo = current_path(); print $foo; ?> in page--foo.tpl, then something like function ...
1
vote
5answers
112 views

How to get the $form_state in hook form submit?

I need to create a node when a comment is submitted in nodes. There are two content types image and memory and I need to get node ID of the node that a user is inserting comment in it. Here is my ...
1
vote
0answers
50 views

Paragraphs Module alter form field

Using the Paragraphs module in Drupal 8, I am attempting to alter the behaviour of the form fields contained within the paragraph field. This is so I can add behaviour like ajax callbacks, hide show ...
0
votes
1answer
17 views

drupal 8-b12: how to assign variables from FormatterBase-Interface to _page_attachments hook?

I have created new field-types in drupal. Therefore I have an Instance of FormatterBase, which gets the values from the database and tries to render the values. but i want to pass the variables ...
0
votes
1answer
22 views

Add an attribute to a specific tag in text body of page

I would like to add an attribute to a specific tag in the text body of a page. I was thinking in this direction: add MYTHEME_preprocess_field(&$variables) to template.php apply regular ...
3
votes
2answers
105 views

revoke access of author to flags

I have a workflow system for my nodes, one of the states is "Disable". also there are some flags on those nodes as well, I'd like to know if there's a way to revoke access of author to use flags when ...
0
votes
0answers
12 views

Quick search view submitting to full search view?

I've got a filter view in Drupal 8 that allows me to filter a specific content type by various taxonomies, dates and titles. I also need a 'quick search' view in the header which has the same ...
0
votes
2answers
17 views

how to uninstall custom database table in drupal 6

I want to create custom table for my custom module "custom_module_table" /** * Implements hook_install(). */ function custom_module_install() { drupal_install_schema('custom_module'); } ...
3
votes
2answers
77 views

How to print edit link on a node page if the current logged-in user has access to node edit

I'm using Display Suite custom fields to have my Edit link rendered somewhere else on the node page, I'd like to see if there's an easy way to check if the current user has the permission to edit the ...
0
votes
1answer
21 views

Calling another function using drupal_get_form

How can I call a function using drupal_get_form when a submit button is clicked. My situation is that i have a custom module where there is only a submit button. So when that submit button is clicked ...
0
votes
0answers
2 views

Get $form_state backup and migrate filter extended class

I have form altered the backup and migrate quick backup screen (admin/config/system/backup_migrate) and added a text field. I'd like to use the value of the field to create a new node just before the ...
-1
votes
1answer
11 views

Hide zip in addressfield form on commerce checkout pane?

How can I hide some fields from addressfield module (for example zip code) on checkout process if certain country is selected? E.G. If US country selected then hide postal code field. If CA country ...
0
votes
0answers
15 views

Drupal handle and process POST request webhook from activecampaign

I'm trying to make a small Drupal project with ActiveCampaign. I already implemented the activecampaign webform and it works but what I want to do is use the webhooks that activecampaingn can offer ...
-1
votes
2answers
36 views

Other modules functions

Is it possible to have a function call within one module which calls a function of a different module even if that function has not been defined as a hook?
0
votes
0answers
8 views

Drupal 6 uc_discounts expiry notification

I would need to trigger a function when a discount defined in uc_discounts expires. Is there any hook or other way to handle this?
1
vote
2answers
17 views

Associate webform submissions with the user created

I am allowing anonymous user create submissions, and creating a user programmatically based on these submissions. How do I associate this submission with the user I've just created? UPDATE: I thought ...
0
votes
1answer
34 views

Get Order Object on Checkout Complete Page (Ubercart - Drupal 6)

I'm trying to develop a new module but just can't get the correct solution, I hope you can help me. On the checkout complete page i need the order object with all information of the just created ...
0
votes
0answers
8 views

wallet or favourite page redirecting

I am stuck in mid of a coupon website where I have to share the coupon to the user favorite page. please help me to know the process on how could I share the full coupon block to the favorite page ...
3
votes
3answers
363 views

What are hooks and can I learn the Drupal Hooks issue if I've yet to learn PHP? [duplicate]

Whenever I try to read about what are Hooks in Drupal, and how to manipulate forms or content with them, the text seem not to deal with the UI at all, but mostly with coding... Maybe I did not ...