Hooks are PHP functions used to interact with the Drupal API.
0
votes
0answers
7 views
Entity don't saves on hook_entity_insert when inserting new field_collection_item - Drupal 8
I use the field collection module. After a new field collection is created I want to save another value in a custom field of a comment.
I use the hook_entity_insert but without success. Nothing is ...
1
vote
1answer
6 views
Creating a module arguments page with a shorter URL
I'm creating two pages with a custom the module. The first page makes an API call to create an XML object and then lists all objects. Each object contains 10 entries but i only display 3 of them. From ...
-1
votes
0answers
6 views
How to create menu tabs mixing hook_menu and views page (menu settings)/
Is there a way to create a tabbed menu with mixed with hook_block and views page display. I have hook menu defined for a url base_url/abc in my custom module. I have created another page with views ...
3
votes
0answers
16 views
Custom access callbacks for user entities not being called
I'm trying to implement some custom access control for user entities, in Drupal 7.
I've used hook_entity_info_alter to set
$entity_info['user']['access callback'] = 'MYMODULE_user_access_callback';
...
1
vote
0answers
20 views
Insert custom html into menu
I am trying to insert the languageswitcher block and login block into the menu. So basically I am after inserting custom html into menu or change the html of a menu link.
Looks like the best place ...
3
votes
2answers
23 views
Custom messages for user_pass_reset
I would like to customize the messages for one time login links (i.e. password reset links). In some cases, I redirect the user to the login page. In these cases, it does not make sense to have "...
0
votes
0answers
33 views
Disable field on hook entity_insert
I am using Drupal 8 and I have created my own content type with many fields defined in hook_entity_insert(). When user creates a node, I want to disable a field. I don't want to change it manually ...
0
votes
0answers
25 views
Proper way to redeclare function in own module
Using module isotope for drupal 7, I would like to redeclare/overwrite the function theme_isotope_filter(array $vars) which is in file isotope.module. But what is the proper name to overwrite it? My ...
0
votes
0answers
6 views
Free shipping and cost shipping in checkout page “drupal 6” ubercart
I want to provide two shipping option on the checkout page,
1) standard free shipping for x days
2) Express Shipping for y days with extra charges.
I'm using ubercart module in drupal 6.
what is ...
0
votes
1answer
13 views
How to detect when $form_state data have expired (and gotten deleted)?
Problem: a user opens a multi-page form and fills out several sections – submitting each time – before returning hours later to finish the remaining parts, leaving their browser open (perhaps needing ...
1
vote
1answer
17 views
Unable to change data type from varchar to text in Drupal 7
I'm trying to change the data type of column "mail" from table "simplenews_subscriber" from varchar to text using hook_update_N but its not getting reflected.
/**
* Implements hook_schema().
*/
...
0
votes
0answers
11 views
Why my hook_block_view_MODULE_DELTA_alter doesn't work?
I installed "Form block" and it creates blocks. I want change block title via my module, but it doesn't work.
Link to this block is: /admin/structure/block/manage/formblock/user_register/configure
...
3
votes
1answer
55 views
How to invoke a custom callback function in Javascript
I am trying to just invoke callback in my AJAX response.
Currently I have the following response.
private function responseWithSuccess($message, $status_code = 200)
{
$ajax_response =...
1
vote
1answer
30 views
Why my hook_block_view doesn't work?
I installed "Form block" and it creates blocks. I want change block title via my module, but it doesn't work.
I create module and set function with hook_block_view:
function zzz_block_view($delta = '...
1
vote
1answer
38 views
Is there another method to call form like drupal_get_form?
I try to get two form in one page from drupal 6 module to drupal 7 module but when i run its just show text "Array". is there any method same like drupal_get_form for calling another form at one page ?...
0
votes
1answer
36 views
Is there any function like number format? [on hold]
I upgraded my drupal 6 module to drupal 7 but I received the error:
Notice: Undefined variable: totpi in tabel_e() (line
1956 of
C:\xampp5.6\htdocs\7\sites\all\modules\s\n\e\e.module).
...
0
votes
0answers
10 views
Fatal error: Call to undefined function ahah_helper_register(
iam trying to convert drupal 6 module to drupal 7 but i received error that i've search anywhere but still i cant fix it. can anyone help me resolve this proble
here's the code
function ...
1
vote
1answer
37 views
Why is the “webform submission updated” hook not using the correct data?
Created a function in respond to hook_webform_submission_update to generate a FillPdf.
function my_module_webform_submission_update($node, $submission) {
if ($submission->nid == 43) {
...
1
vote
1answer
20 views
What hook should I use to attach a script to a content type?
I have this function from a standalone php script that redirects the user based off the user agent. In the process of merging this into Drupal and the script only needs to execute for a specific ...
2
votes
2answers
48 views
How do I find the hooks used by this module?
How can I find out what hooks are available in the Entity Clone module? I want to modify the entity after it is cloned to change its author and workflow state.
1
vote
2answers
90 views
How to render a view programmatically and set as node field?
I am trying to render custom view and put the result as content of the node.
Here is my code
function my_theme_preprocess_node(&$variables)
{
if (isset($variables['node']) && $...
0
votes
1answer
32 views
hook_menu URL giving 404 error on running site randomly
I have a hook_menu URL exposed as a URL and I am also calling the same callback function separately in code
The URL returns 404 at error at sometimes and starts working fine after a cache clear.
...
1
vote
0answers
12 views
A template choice decision source code
I am trying to find the code that is responsible for deciding which template file to choose in different cases. For example I need find out what are possible template names for the form rendering.
I ...
0
votes
1answer
28 views
hook_theme_suggestions_HOOK() doesn't work
I am making a template in Drupal 8. At this moment, I made a theme in the /themes directory; there, I have my .theme file and a copy of the html.html.twig file from the core/themes/stable directory.
...
3
votes
1answer
26 views
Alter module js for on custom page
I have a small problem with altering js code loaded from custom module. I need to change the js script from a module for a custom page
Module code code :
function module_script_src($environment) {
...
3
votes
1answer
33 views
How add custom node in a View (Nested View)?
Currently I have simple view that is used on the main page. In includes nodes of custom type. That's great. But now I need to do something different.
Consider I have following structure:
-----View---...
0
votes
1answer
18 views
How can I make an order generated through Services invoke hooks or checkout complete?
I am stuck at integrating a Drupal Commerce store with Services.
I setup a REST server. In several steps I can login, create a user, create user shipping/billing profiles, create an order, add line-...
3
votes
2answers
66 views
How to create a hook for a module in a theme?
I am trying to alter some data that is being passed from the Language Switcher module.
Here is a code snippet from the module.
if (isset($links->links)) {
$build = array(
'#theme' => '...
0
votes
1answer
14 views
CKEditor Content Change on Hook
First question here.
I am new to Drupal and am working on a new content type. I created a hook that loops through a .csv file on its load and makes a <table> from it.
What I want to do now is ...
0
votes
1answer
12 views
How to render node content according to site theme after hook_node_insert/update?
How can I get the actual HTML of the node when i am in hook_node_insert/update?
I would like to get the rendered HTML as it should appear in the site and save it somewhere else ...
I am working in ...
0
votes
0answers
28 views
Accessing fields of a node in a twig template [duplicate]
I have recently started exploring Drupal. And have a lot of questions about it. But now I am specifically interested in the Drupal Twig template engine.
I don't understand approach used in Drupal.
...
1
vote
2answers
16 views
hook_form_alter multiple Content Type
How I use hook_form_alter with multiple Content Type..
function custom_form_alter(&$form, &$form_state, $form_id) {
if($form_id == 'register_node_form' || 'session_node_form'){
if(empty($...
3
votes
1answer
33 views
Using attributes in templates Twig
I am a newbie. I have experience working with Twig but in Drupal it is used in another way.
I have seen a lot of code like that
<section{{ attributes.addClass(classes) }}>
And of course I ...
1
vote
1answer
48 views
Submitting a form, when using the same form with different ID are on a page
Here is what happens:
I've create a content type poll, which admin can create polling questions and answers. Then this polling node will be rendering in a new Page node with node reference (using ...
1
vote
1answer
38 views
Theming contact page form
How to add in Drupal 8 a custom (suggestion) default contact page template ?
Thank you
1
vote
1answer
41 views
Alternate of using “delivery callback”
$items['mymodule/%user'] = array(
'title' => 'My Module',
'page callback' => 'mymodule',
'page arguments' => array(1),
'access arguments' => array('access user profiles'),
'type' ...
1
vote
1answer
24 views
How to use hook_form_alter to hide a form field for certain users?
function custom_form_alter(&$form, &$form_state, $form_id) {
global $user;
$node = node_load(arg(1));
$num = $node->field_node_reference['und'][0]['nid'];
$val = node_load($num);
$...
1
vote
0answers
30 views
How do I call a PHP function in all the pages? [closed]
I used the Boost module for performance issues, and it creates _.html files every time it serves a file from the cache. I need to write a PHP function it should call every page, even the cached ones. ...
1
vote
2answers
35 views
After node creation how do i add simple buttons to edit the field values
``I'm new to drupal,I'm trying a create a content type with some field values which the user can use to create the content for the content type.In the node_view i have added some markup html to create ...
0
votes
0answers
13 views
Which hook use to change the smtp account used to send an email?
I've seen there are some modules ("phpmailer" and "smtp authentication support") that you should usen to send email with a given SMTP account.
But I need to use a different SMTP account depending on ...
0
votes
1answer
21 views
How do I return an SQL query result as custom variable in a template?
Is there any way to pass a SQL result with using hook in .theme file? My scenario is following: I have a paragraphs module's view in which I've need of all nodes from content type News to iterate and ...
1
vote
0answers
23 views
Views AJAX reset Hook
I found a solution that replaces the default reset functionality by an AJAX , It's working fine in my Bootstrap Theme , but I have one problem ! when I click the reset button the dropdown select list ...
0
votes
0answers
43 views
How to join custom table in views hook_views_data
I have 3 tables.
1) linkchecker_link
lid | url | error
1 | google.com | 404
2 | xyz.com | 404
2) linkchecker_node
lid | nid
1 | 4
2 | 5
3) node(drupal node table)
nid ...
3
votes
1answer
22 views
How to detect insertion of new item(s) into Drupal's queue?
I need to trigger some code when new items are added to Drupal's queue system. My question, how to do that? How to capture that event?
Further details
I have created a custom views bulk operation ...
1
vote
1answer
16 views
add form to /cart, commerce cart page
Is there a way to add another form to the /cart page in drupal commerce? I have a need to show another view with operations on the cart page for stored shopping carts and quotes. I don't want to ...
0
votes
1answer
28 views
Ajax button doesn't work
I followed this tutorial:
https://rapiddg.com/blog/creating-ajax-callback-user-reference-fields
to create a button to fill some field in a form with the values of the current user.
Here the cose I ...
0
votes
1answer
41 views
access callback admin permission is not working
This is a follow up to drupal.stackexchange.com/q/228722/9921
I have an api that I creates that I would like to restrict access to users with administrator role. But for some reason the '...
1
vote
0answers
24 views
Hooks in the render pipeline
What hooks are there in the render pipeline in between
(A)
hook_entity_display_build_alter,
hook_entity_view,
hook_ENTITY_TYPE_view,
hook_entity_view_alter,
hook_ENTITY_TYPE_view_alter,
and
(B)
...
1
vote
1answer
33 views
Breadcrumb add content type data without any modules
How could I print content type like the breadcrumb, for example
Home/Content type/Create
0
votes
1answer
25 views
Different Theme for Current URL - Using Javascript?
I know that you can have different themes for different parts of the site, assigning specific URLs to different themes by using hook_custom_theme() or the themekey module - I've used both solutions to ...