Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I know how to add a template to a node in the template.php file.
function mysite_theme() {
return array(
'survey_node_form' => array(
'render element' => 'form',
'path' => drupal_get_path('theme', 'mysite') . '/templates',
'template' => 'survey-node-form'
),
);
}
But when I reference this content type using Inline Entity Fields the theme does not apply.
I have also seen how to change an inline entity from within a module, but can't figure out how to use it to change the theme.
function mymodule_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
if ($entity_form['#entity_type'] == 'node') {
$entity_form['field_my field_ref']['#theme'] = 'referencedentity-node-form';
}
}
This works when, instead of theme, I use an attribute like #markup to add some text, but I am trying to apply a theme. I have tried #template also, with no luck. Thanks.
Comments
Comment #2
achikas CreditAttribution: achikas commentedi also think that i will get a referenced entity form layouted with DS thru the IEF. but there is none.
would be great to get a hint how to theme the display of the referenced entity form fields when using IEF.
Comment #3
dcam CreditAttribution: dcam as a volunteer commentedI'm closing old IEF support issues. Please feel free to re-open the issue if you still require assistance.