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

learn more… | top users | synonyms (1)

0
votes
2answers
20 views

How to create question/answer form?

I need to create a textarea (textfield) that every user who visits the site be able to ask his/her question via this textarea (textfield), and then the content managers will answer the question and ...
0
votes
0answers
20 views

Why can we not name our wildcards in HOOK_menu()? [duplicate]

Pretty generic question but in D7 when creating a new menu item with a wildcard, why can I not name my wildcards something generic so that the code is easier to understand? E.g. This doesn't work: ...
1
vote
1answer
32 views

Hooks placements in Drupal 7

I am trying to place some hooks, but i don't even think they are being called. THEMENAME_menu_alter(&$items) and THEMENAME_user_view_access($account) are the hooks i am placing in my ...
0
votes
0answers
30 views

onClick event on the submission button of an AJAX form [on hold]

I've an AJAX form, built by contributed module, and I need to add a JavaScript listener (for the click event) to the submission button, but I did not get to work. I have tried: Adding the listener ...
0
votes
0answers
11 views

Changing the term url switch statment for the field

I want change the path of the term by the field name. But the problem is all the term field changes to the 1st switch statement. y i.e return array('path' => 'news/path/' . $term->tid); ...
-1
votes
2answers
35 views

Which hook for a warning message?

Which Hook should I use to simply print a message if a configuration is not done yet? The only idea i've got was hook_node_view, but maybe someone knows something better ?
0
votes
0answers
21 views

Function for different content types [closed]

How would you set this to for different content types please? function termspath_entity_info_alter(&$entity_info) { $entity_info['taxonomy_term']['uri callback'] = ...
-2
votes
0answers
14 views

How to make drupal database scalable [closed]

How to make drupal database scalable and how to optimize the database queries
-2
votes
0answers
19 views

How to add form in to node view

I want to add one form link in particular node view . means in my site many content creater/node creator if anonymous user want to contact with node owner, so i want to attach form link in node view ...
0
votes
1answer
16 views

Media module function overriting, user can see only own media

As title says, I need to override few media module functions and add some extra conditions when selecting media. I wanted to create new module that extends media module and overrides those functions ...
0
votes
1answer
21 views

During which bootstrap phase hook_exit & hook_boot will be invoked?

Project Documentation says.. Both are invoked even for cached page views. hook_boot says This hook is run at the beginning of the page request. It is typically used to set up global parameters ...
0
votes
1answer
18 views

How to change path that username points to

I have basically disabled user accounts from being accessed, because I am using Profile2 module for user profiles. So there is no need to view the users account page. But in posts and forums in my ...
1
vote
2answers
88 views

Using hook_form_FORM_ID_alter to add CSS class to Simple Hierarchical Select

I'm trying to use hook_form_FORM_ID_alter to add a CSS class to one of the select element. I'm trying to add a CSS class "form-control", to the <select ...
0
votes
1answer
39 views

Ajax example dependent dropdown callback [duplicate]

I have two custom Drupal modules moduleA and moduleB. moduleA has all the functions for Ajax calls i.e. ajax_example_dependent_dropdown_callback and _ajax_example_get_second_dropdown_options. I ...
0
votes
0answers
29 views

Problem using two fields in hook_views_query_alter()

I am currently using Drupal 7 and Views 3. I have to make custom drop down filter for 'Month' and 'Year' for node post date. So, I chose two 'Content:Post date' filters from views. One has machine ...
0
votes
0answers
13 views

Best way to remove secondary links on certain pages

In a custom module I wish to remove the secondary links to certain pages. I do not know the best hook to use. I want to do this at a module level and not in a theme. I thought hook_page_alter may be ...
0
votes
1answer
9 views

Webservice endpoint with hook_services_resources()

I've stumbled upon some limitations of the services module. I wanted to create the following endpoints: public/events/ public/events/categories public/events/resources public/blogs/ I wanted to ...
0
votes
0answers
14 views

How prevent taxonomy insert to database When add a taxonomy?

I use Service Module with mobile app. And want to limit user to create taxonomy. I tried: I try to use hook_taxonomy_term_insert, But It seems after taxonomy insert to database, the ...
0
votes
0answers
15 views

How are pages rendered? [duplicate]

For the longest time, I have relied on Drupal modules to manage all of my custom site needs. I would like to approach Drupal from a more programmatic angle. I have an intermediate level of PHP ...
0
votes
2answers
29 views

hook_form_FORMID_alter not working

function send_xml_form_user_profile_form_alter(&$form, &$form_state){ $form["#submit"][] = 'send_xml_edit_account_submit_function'; drupal_set_message('<pre>' . ...
0
votes
2answers
46 views

hook_permission and control access [how to redirect to the login page if user not logged in]

How does one limit "what" can access a page. I have little understanding on how to use hook_permission() to set user permission based on a role to control access to hook_menu() items. However, what if ...
0
votes
3answers
44 views

How to validate file using hook_file_validate? [duplicate]

I want to validate my file, I'm using hook_file_validate function test_file_validate($file) { $errors = array(); if (empty($file->filename)) { $errors[] = t("The file's name is ...
3
votes
2answers
67 views

hook_module_implements_alter() to put hook implementations into separate files - bad practice?

In a number of modules I wrote, I use hook_module_implements_alter() to split up the *.module file, and to move hook implementations into separate files. The main reason is that I passionately hate ...
1
vote
0answers
21 views

Is there a hook to alter a field before the input filters process it?

I'm looking at a module that uses hook_field_attach_view_alter to convert any of its tokens in a text field into valid markup. The problem is that the text field passed in to ...
0
votes
0answers
14 views

how to validate file using #upload_validator in drupal [duplicate]

i am using #upload_validators,using this reference https://drupal.org/node/546146#comment-8638769 but this is not working, Please let me know.. is it working in drupal 7 or not or for this ...
0
votes
2answers
39 views

Show block for specific content type programmatically

How can I show a block on a specific content type programmatically? I want in my image the 'basic page' selected. I used the xxx_block_info() function, should it set in here?
0
votes
0answers
5 views

openpublish 7 hook_menu

have been asked to move a custom made module to another drupal site which is based on openpublish version 7. but after adding/activating the module , the hook menu does not seem to be working. Just ...
0
votes
0answers
26 views

How to use [#upload_validators] in drupal 7 [duplicate]

I want to validate my form ajax based through serverside custom code I am using that code in the below , but ['#upload_validators'] is not working in Drupal 7,please give me any refrence. function ...
0
votes
0answers
9 views

Using the data from one view block in another view

I have a page that loads two custom views (from an external data API). The data that both of these views loads is identical causing two every api calls for every page load. One view is a map and ...
0
votes
1answer
22 views

Adding default text to input field

I was needing to add a default value to a text field that disappears when you click on the field. I did found this question : How to add default text that clears on focus to a form in Drupal? ...
0
votes
0answers
15 views

Styling Forms in Drupal 7 with Twitter Bootstrap [duplicate]

Being a complete Drupal noob i'm lost in a vast amount of conflicting information in my searches. I'm finally getting to the polishing part of my website, I'm wanting to stat styling my forms like I ...
-4
votes
0answers
20 views

how can i decrease page load time in drupal [duplicate]

I have developed my website in drupal http://yourwebworld.com/myluckymatch/ When i enter url in the browser my website is open very slow, Please let me know how can i decrease my website loading ...
-2
votes
3answers
36 views

insert checkboxes in data base

I want to insert a checkboxes in database ,I do not guess how it works <?php /** * * Implements hook_permissions. */ function demande_permission(){ return array( 'submit_demande' ...
0
votes
1answer
9 views

Custom content drupal6

I'm new to drupal, so forgive me if my question will be silly :) I've a little problem with my first custom content on a drupal 6 installation. My content "biography" is listed in admin/content/types ...
0
votes
0answers
24 views

Remove disabled menu links from menu settings

I have a multilingual site, and when adding content theres an option to add a menu link. Both languages show up in the drop down selection, my goal is to hide/remove the links that are "disabled" (NOT ...
-1
votes
2answers
84 views

Combine two functions [closed]

How can I combine two functions? Now I get the error: Cannot redeclare xxx_form(). As example: function node_example_form($node, $form_state) { return node_content_form($node, $form_state); } ...
0
votes
1answer
27 views

problems with entity translation insert hook

I'm using the entity_translation_insert() hook to set the value of a field when a node is translated. I can successfully edit the $entity from within the implementation, but how should I save the ...
0
votes
0answers
19 views

How to override uc_cart_checkout_form()?

Is there a hook_checkout_form of some sort? How can I alter uc_cart_checkout_form()? The function itself located in uc_cart.pages.inc and not the form. As I can just do this with hook_form_alter. ...
0
votes
2answers
106 views

Fatal error: Cannot use object of type stdClass as array in [closed]

I get an fatal error on the 'add content page'. Fatal error: Cannot use object of type stdClass as array in function mymodule_form($form, $form_state){ $form['mymodule'] = array( ...
0
votes
1answer
29 views

Show hook_form on specific content type Drupal 7 Programmaticaly

How can show a form that is created with the drupal _hook form api, on a specific content type? So, as example: I created new content for the content type 'outside' when I click on save I see the ...
0
votes
1answer
36 views

Drupal webform Post to Google Spreadsheet

I have a webform with some options and fields. When user submit the form i receive an email. I want to hook right before(or after) drupal send the email and populate my Google Spreadsheet so i can ...
1
vote
3answers
40 views

Redirects within hook_user_login

I'm writing a module that redirects the user on login and am having trouble getting anything to work. Here is what I tried within hook_user_login: submission.info name = Submission description = ...
0
votes
1answer
29 views

hook to redirect user before they create node?

I'm running a db_query to check if the user has taken a specific action. If they haven't, I'm redirecting them to the page where they can take that action. function my_special_module_node_view(...) { ...
1
vote
2answers
25 views

Cannot set form #default_value when altering Views Exposed Filter forms

function mymodule_form_alter(&$form, &$form_state, $form_id) { drupal_set_message($form_id); if ($form_id == 'views_exposed_form') { $options = array( 'All' => t('All'), ...
0
votes
1answer
16 views

Custom Main Menu Text

I want to generate custom text for one of the buttons on my pages main menu. Basically, if a user is logged in and has a first name defined in their profile it should read "Fist Name" otherwise it ...
0
votes
1answer
40 views

preg_replace() not working on node title in hook_preprocess_page()

Here's code from my module: function mymodule_preprocess_page(&$variables) { // load the node object $node = node_load(arg(1)); $fied = $node->field_building_sell['und'][0]['value']; ...
1
vote
2answers
24 views

Drupal 7 Private Files - How to override security in custom module

Is there a hook to override access to images stored in the private file system when theme_image_style is used to output the image?
1
vote
1answer
35 views

hook_preprocess_node() or hook_node_view() for html altering the field

What's the best way to alter html of an image field? I have imagefield and i want to rewrite it's html from scratch.
1
vote
1answer
43 views

Remove the Argument from a views URL

I have a view with an exposed filter using the hierarchical select module for taxonomy. /browse?category=12345 On the same view, I have an argument which does the same thing. /browse/12345 I want ...
0
votes
1answer
17 views

Are there any hooks for the event when an user navigates the verification URL?

I'm looking for a way to modify an event (from my own module) when an user navigates to the account activation URL that they get in their mails. Are there any such hooks ready for me to use? Also I ...