1

This question already has an answer here:

My module implements hook_menu() in order to define a settings page:

function MYMODULE_menu() {
    $items = array(
        'admin/config/system/mymodule' => array(
            'title' => 'MyModule settings',
            'description' => 'Various settings for MyModule.',
            'page callback' => 'drupal_get_form',
            'page arguments' => array('__MYMODULE_settings'),
            'access arguments' => array('administer site configuration'),
            'type' => MENU_NORMAL_ITEM
        )
    );
    return $items;
}

That settings page takes it's settings from __MYMODULE_settings():

function __MYMODULE_settings() {
    $form = array(
        'my_text_field' => array(
            '#type' => 'textfield',
            '#required' => TRUE,
            '#title' => 'Facebook link'
        ),
        'my_node_field' => array(
            '#type' => 'entityreference',
            '#required' => TRUE,
            '#title' => 'Contact node'
        ),
        'submit' => array(
            '#type' => 'submit',
            '#value' => 'Save'
        )
    );
    return $form;
}

However when I do this, the "my_node_field" field (of type entityreference) doesn't display.

On the settings form I want to have a setting that points to a node. I'd like to use the "entityreference" module for that setting — I already have entityreference installed, and I'm using it to put node reference fields on a handful of my content types.

Looking at entityreference_field_info(), it looks like entityreference defines a field called "entityreference" — shouldn't I be able to use this field?

marked as duplicate by Clive Jul 15 '13 at 8:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    I removed the bounty and refunded points - the duplicate question contains at least one answer that definitely works (by jmcouillard) – Clive Jul 15 '13 at 8:19

Browse other questions tagged or ask your own question.