Questions tagged [hook-theme]

hook_theme() is the hook used to register the theme functions implemented by Drupal themes and modules.

The implementations declared by hook_theme() have two purposes: either they specify how a particular render array is to be rendered as HTML (this is usually the case if the theme function is assigned to the render array's #theme property), or they return the HTML that should be returned by an invocation of theme().

8 questions
3
votes
1 answer

Hook a twig template to a block in Drupal 8

I created a module which creates a custom block :
123pierre
  • 305
  • 1
  • 4
  • 18
2
votes
1 answer

Drupal 7 Custom Template Using hook_menu

I am trying to make custom page template using these hooks in Drupal 7 but it shows blank page when i open in browser. Here is my code /* Implements hook_menu(); */ function story_menu () { $items['story/filters'] = array( 'title' =>…
Touqeer Shafi
  • 5,084
  • 3
  • 28
  • 45
1
vote
2 answers

Drupal 7 - get variables from hook_theme

I tried to pass a variable from a custom module to a tpl file. In my custom module (named example) 1. I created a route with an argument via hook_menu : function example_menu() { $items['example/fancybox-photos/%'] = array( 'page callback'…
Tom1x
  • 21
  • 5
1
vote
1 answer

Drupal 8 hook_menu() to render hook_theme()

I am finally diving in to Drupal 8 for a project. In my module though I can not seem to nail down how to render a template from my module based on the route. In Drupal 7 I would normally do this custom.module function union_views_menu() { $items…
NicholasByDesign
  • 781
  • 1
  • 11
  • 33
0
votes
1 answer

How to remove default form tag while rendering output in hook_theme

I am customizing the login form. I have to put all the three forms(login, register, forgotpassword) into one page. This is my code. template.php function bartik_theme() { $items = array(); $items['user_login'] = array( 'render…
Surya
  • 37
  • 6
0
votes
1 answer

Drupal hook_theme error

I am attempting to apply a custom theme to a single page. The page is one I have setup using hook_menu. I have impletemted hook_theme but when I refresh the website, I get the following error: Fatal error: Unsupported operand types in…
sisko
  • 9,604
  • 20
  • 67
  • 139
0
votes
1 answer

drupal form override theme function

i created a module that generates a small form. I also made a function that should theme the form, overriding the standard theme. But form some reason it doesn't call the theme_ function. Am i forgetting something? function mailinglist_menu() { …
dazz
  • 8,162
  • 9
  • 31
  • 41
0
votes
1 answer

drupal 7 form theme function not being called

I'm trying to register a theme function for a simple form in a custom module, but the theme function is not being called. I just get the basic form. Here's my hook_theme(): function kss_membership_theme($existing, $type, $theme, $path){ $items…
user497587
  • 45
  • 9