function block_inject_add_inject_form in Block Inject 7
Callback form to add new region.
1 string reference to 'block_inject_add_inject_form'
- block_inject_menu in ./
block_inject.module - Implements hook_menu().
File
- ./
block_inject.admin.inc, line 123 - The admin functions for the module.
Code
function block_inject_add_inject_form($form, &$form_state) {
$form['block_inject_region_name'] = array(
'#type' => 'textfield',
'#title' => t('Region name'),
'#description' => t('What is the name of the region you would like to inject?'),
'#required' => TRUE,
);
// Return available node types to have as options for the select form element.
$node_types = block_inject_get_node_types();
$form['block_inject_content_type'] = array(
'#type' => 'select',
'#title' => t('Available Content Type(s)'),
'#description' => t('Which content type would you like this region to be
injected in the middle of?'),
'#options' => $node_types,
'#multiple' => TRUE,
);
$form['block_inject_conditionals_toggle'] = array(
'#title' => t('Would you like to condition the placement of the region injection?'),
'#type' => 'checkbox',
);
$form['block_inject_conditionals'] = array(
'#title' => t('The condition'),
'#type' => 'fieldset',
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
// Show only if conditional checkbox is selected.
'#states' => array(
'visible' => array(
'input[name="block_inject_conditionals_toggle"]' => array(
'checked' => TRUE,
),
),
),
);
$form['block_inject_conditionals']['block_inject_explanation_1'] = array(
'#type' => 'markup',
'#markup' => t('The destination needs to have '),
);
$form['block_inject_conditionals']['block_inject_paragraph_operator'] = array(
'#type' => 'select',
'#options' => array(
'<' => 'less than',
'=' => 'exactly',
'>' => 'more than',
),
'#multiple' => FALSE,
);
$form['block_inject_conditionals']['block_inject_paragraph_number'] = array(
'#type' => 'textfield',
'#maxlength' => 3,
'#size' => 4,
);
$form['block_inject_conditionals']['block_inject_explanation_2'] = array(
'#type' => 'markup',
'#markup' => t(' paragraphs in order to fire the offset action below.'),
);
$form['block_inject_action'] = array(
'#title' => t('The action'),
'#type' => 'fieldset',
'#description' => t('The action to take if the condition above is met.'),
// Show only if conditional checkbox is selected.
'#states' => array(
'visible' => array(
'input[name="block_inject_conditionals_toggle"]' => array(
'checked' => TRUE,
),
),
),
);
$form['block_inject_action']['block_inject_paragraph_offset'] = array(
'#title' => t('Paragraph offset'),
'#type' => 'textfield',
'#description' => t('Please specify a positive or negative number to
offset the injection (e.g. 1 to move down by one paragraph /
-1 to move up by one paragraph).'),
);
$form['block_inject_region_submit'] = array(
'#type' => 'submit',
'#value' => t('Create region'),
);
return $form;
}