From 749e3cb1cdb4b3854016a167d8752b5e50c1a283 Mon Sep 17 00:00:00 2001 From: Jaime Herencia Date: Sun, 16 Sep 2012 14:51:32 +0200 Subject: [PATCH] Issue #1719948 by jherencia: Integration with inline entity form --- auto_nodetitle.module | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/auto_nodetitle.module b/auto_nodetitle.module index 30e6e4f..fc925ce 100644 --- a/auto_nodetitle.module +++ b/auto_nodetitle.module @@ -39,6 +39,25 @@ function auto_nodetitle_form_node_form_alter(&$form, &$form_state, $form_id) { } /** + * Implements hook_inline_entity_form_entity_form_alter(). + */ +function auto_nodetitle_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) { + if ($entity_form['#entity_type'] == 'node') { + $setting = auto_nodetitle_get_setting($entity_form['#entity']->type); + if ($setting == AUTO_NODETITLE_ENABLED) { + // We will autogenerate the title later, just hide the title field in the + // meanwhile. + $entity_form['title']['#value'] = 'ant'; + $entity_form['title']['#type'] = 'value'; + $entity_form['title']['#required'] = FALSE; + } + elseif ($setting == AUTO_NODETITLE_OPTIONAL) { + $entity_form['title']['#required'] = FALSE; + } + } +} + +/** * Implements hook_node_submit(). * * Generate the node title as soon as the form has been submitted. That way -- 1.7.12