function ctools_context_node_edit_form_settings_form

1 string reference to 'ctools_context_node_edit_form_settings_form'
node_edit_form.inc in plugins/contexts/node_edit_form.inc
Plugin to provide a node_edit_form context.

File

plugins/contexts/node_edit_form.inc, line 90

Code

function ctools_context_node_edit_form_settings_form($form, &$form_state) {
    $conf =& $form_state['conf'];
    $form['node'] = array(
        '#title' => t('Enter the title or NID of a node'),
        '#type' => 'textfield',
        '#maxlength' => 512,
        '#autocomplete_path' => 'ctools/autocomplete/node',
        '#weight' => -10,
    );
    if (!empty($conf['nid'])) {
        $info = db_query('SELECT * FROM {node} WHERE nid = :nid', array(
            ':nid' => $conf['nid'],
        ))->fetchObject();
        if ($info) {
            $link = l(t("'%title' [node id %nid]", array(
                '%title' => $info->title,
                '%nid' => $info->nid,
            )), "node/{$info->nid}", array(
                'attributes' => array(
                    'target' => '_blank',
                    'title' => t('Open in new window'),
                ),
                'html' => TRUE,
            ));
            $form['node']['#description'] = t('Currently set to !link', array(
                '!link' => $link,
            ));
        }
    }
    $form['nid'] = array(
        '#type' => 'value',
        '#value' => $conf['nid'],
    );
    $form['set_identifier'] = array(
        '#type' => 'checkbox',
        '#default_value' => FALSE,
        '#title' => t('Reset identifier to node title'),
        '#description' => t('If checked, the identifier will be reset to the node title of the selected node.'),
    );
    return $form;
}