0

I am trying to change the widget type for title field in content type (currently it's a text field as default). Now I want to change to node reference.

4 Answers 4

1

i think, it is better to remove the original field 'title' and create new field for node reference type, use:

<?php
    function your_module_form_alter(&$form, &$form_state, $form_id) {
        if($form_id == 'your_node_form'){
            $form['title']['#access'] = FALSE;
        }
    }

?>
1

There is also http://drupal.org/project/auto_entitylabel which can help you hide the title and automatically fill the title field using tokens.

See this video for a howto http://codekarate.com/daily-dose-of-drupal/drupal-7-automatic-entity-label-module.

0

You can't use a widget as such; the title isn't a field, it's a property of the node entity type and doesn't have the capacity to use a field widget (without some serious messing about).

Also I don't think a node reference would work quite as you expect for this. The value saved by a node reference field is the ID of the referenced node, not the title, so you would simply be creating nodes whose titles are the IDs of other nodes.

You could probably look at implementing your own autocomplete for the title field if you really want to do this, but it will involve some code. Have a look at the form examples in the Examples module for some inspiration, there's some related stuff in there.

0

That is not possible. But you can try this:

  1. Add an other fileld with the required widget type.
  2. Use the automatic node title module to set the title to the value of the extra field. The module does give you the possibility to hide the original title field alltogether.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.