Skip to main content
added 68 characters in body
Source Link
norman.lol
  • 19.1k
  • 6
  • 75
  • 129

I've just been encountering a similar problem. And solved it like following.

In my MYMODULE.module file:

function MYMODULE_theme($existing, $type, $theme, $path) {    return [  'mythemename' => [   'render element' => 'form',   'template' => 'my-template-name',   ], ]; } 

In the form$form:

$form['#theme'] = 'mythemename'; 

And finally in the my-template-name.html.twig template:

<div class="someclass"> {{ form }} </div> 

I've just been encountering a similar problem. And solved it like following.

In my MYMODULE.module file:

function MYMODULE_theme($existing, $type, $theme, $path) { 'mythemename' => [ 'render element' => 'form', 'template' => 'my-template-name', ], } 

In the form:

$form['#theme'] = 'mythemename'; 

And finally in the template:

<div class="someclass"> {{ form }} </div> 

I've just been encountering a similar problem. And solved it like following.

In my MYMODULE.module file:

function MYMODULE_theme($existing, $type, $theme, $path) {    return [  'mythemename' => [   'render element' => 'form',   'template' => 'my-template-name',   ], ]; } 

In the $form:

$form['#theme'] = 'mythemename'; 

And finally in the my-template-name.html.twig template:

<div class="someclass"> {{ form }} </div> 
added 30 characters in body
Source Link
norman.lol
  • 19.1k
  • 6
  • 75
  • 129

I've just been encountering a similar problem. And solved it like following.

In my .moduleMYMODULE.module file:

 function my_module_theme MYMODULE_theme($existing, $type, $theme, $path) { 'mythemename' => [   'render element' => 'form',   'template' => 'my-template-name',   ],  } 

In the form:

$form['#theme'] = 'mythemename'; 

And finally in the template:

<div class="someclass"> {{ form }} </div> 

I've just been encountering a similar problem

In my .module

 function my_module_theme ($existing, $type, $theme, $path) { 'mythemename' => [   'render element' => 'form',   'template' => 'my-template-name',   ],  } 

In the form

$form['#theme'] = 'mythemename'; 

And finally in the template

<div class="someclass"> {{ form }} </div> 

I've just been encountering a similar problem. And solved it like following.

In my MYMODULE.module file:

function MYMODULE_theme($existing, $type, $theme, $path) { 'mythemename' => [ 'render element' => 'form', 'template' => 'my-template-name', ], } 

In the form:

$form['#theme'] = 'mythemename'; 

And finally in the template:

<div class="someclass"> {{ form }} </div> 
Source Link

I've just been encountering a similar problem

In my .module

 function my_module_theme ($existing, $type, $theme, $path) { 'mythemename' => [ 'render element' => 'form', 'template' => 'my-template-name', ], } 

In the form

$form['#theme'] = 'mythemename'; 

And finally in the template

<div class="someclass"> {{ form }} </div>