function ddblock_select_nodes_form in Dynamic display block 7
Same name and namespace in other branches
- 6 ddblock.module \ddblock_select_nodes_form()
Build the node selection form element.
This function is also called when generating a new set of options during the AJAX callback, so an array is returned that can be used to replace an existing form element.
Parameters
$form: form to add elements to.
$content_type: selected content type.
$nodes: Existing nodes added to the block.
Return value
form fields.
2 calls to ddblock_select_nodes_form()
- ddblock_block_configure_form in ./
ddblock.module - Block configuration page of dynamic display block blocks added to standard block configuration page.
- ddblock_select_nodes_js in ./
ddblock.module - AHAH callback to replace node select options.
File
- ./
ddblock.module, line 799 - Enables your site to display dynamic content in a block.
Code
function ddblock_select_nodes_form(&$form, $content_type, $nodes) {
// Wrapper for nodes select box.
$form['content']['content_types']['select_nodes'] = array(
'#type' => 'hidden',
'#value' => -1,
'#prefix' => '<div id="select-nodes-wrapper">',
);
// no content type selected (show text 'No content type selected').
if ($content_type == 'none') {
$form['content']['content_types']['select_nodes']['#prefix'] .= '<em>' . t('No content type selected.') . '</em>';
$form['content']['content_types']['select_nodes']['#suffix'] = '</div>';
unset($form['content']['content_types']['nodes']);
}
else {
if (user_access('administer dynamic display blocks')) {
// get all nodes of a content type which are not added yet to the block.
$options = _ddblock_get_content_type_nodes($content_type);
$form['content']['content_types']['nodes'] = array(
'#type' => 'select',
'#title' => t('Node'),
'#default_value' => $nodes,
'#description' => t('The node to show in the Dynamic display block'),
'#options' => $options,
'#attributes' => array(
'class' => array(
'content-type-select',
),
),
'#suffix' => '</div>',
);
}
}
return $form;
}