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

gettysburger created an issue. See original summary.

achikas’s picture

i 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.

dcam’s picture

Status: Active » Closed (outdated)

I'm closing old IEF support issues. Please feel free to re-open the issue if you still require assistance.