function sna_blocks_plugin_style_snablocks::options_form in Simple Node Archive Blocks 7.2
Provide a form to edit options for this plugin.
Overrides views_plugin_style::options_form
File
- ./
sna_blocks_plugin_style_snablocks.inc, line 25 - Contains the list style plugin.
Class
- sna_blocks_plugin_style_snablocks
- Style plugin to render simple node archive.
Code
function options_form(&$form, &$form_state) {
// Wrap all the form elements to help style the form.
$form['sna_blocks_wrapper'] = array(
'#markup' => '<div id="sna-blocks-form-wrapper"><b>Note:</b> As the archive settings for each block is unique. It is recommended to override view "Block: Style options" for blocks.',
);
// Set Default value for field_name.
$disabled_field_name = TRUE;
$default_field_name = 'node_created';
if (module_exists('date')) {
$disabled_field_name = FALSE;
$default_field_name = $this->options['field_name'] ? $this->options['field_name'] : 'node_created';
}
$form['field_name'] = array(
'#type' => 'textfield',
'#title' => t('Archived date field machine name'),
'#default_value' => $default_field_name,
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#disabled' => $disabled_field_name,
'#description' => t('Achived block will created based on this field. Default value is node posted date "node_created". For custom field use <a href="http://drupal.org/project/date" target="_blank">Date module</a> and provide field machine name here. You have to add the field to views "FIELDS" list.'),
);
$form['sna_view_name'] = array(
'#type' => 'textfield',
'#title' => t('View machine name'),
'#default_value' => $this->options['sna_view_name'] ? $this->options['sna_view_name'] : '',
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#description' => t('The machine name of the view whose page is used to display archive result.'),
'#prefix' => '<br>A view page is required to display achive result. You need to create a page and then use below setting for page.<hr>',
);
$form['sna_view_display_id'] = array(
'#type' => 'textfield',
'#title' => t('View page display id.'),
'#default_value' => $this->options['sna_view_display_id'] ? $this->options['sna_view_display_id'] : '',
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#description' => t('The view page display id, e.g. page_1'),
);
$form['sna_view_page_url'] = array(
'#type' => 'textfield',
'#title' => t('View page display URL.'),
'#default_value' => $this->options['sna_view_page_url'] ? $this->options['sna_view_page_url'] : '',
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#description' => t('View page path.'),
);
$disabled_jquerymenu_option = TRUE;
if (module_exists('jquerymenu')) {
$disabled_jquerymenu_option = FALSE;
}
$form['sna_use_jquery'] = array(
'#type' => 'checkbox',
'#default_value' => $this->options['sna_use_jquery'] ? $this->options['sna_use_jquery'] : 0,
'#title' => t('check this box if you want to use <a href="http://drupal.org/project/jquerymenu" target="_blank">Jquerymenu module </a> to theme archive block.'),
'#disabled' => $disabled_jquerymenu_option,
'#prefix' => '<br><b>Theme archive block:</b> <hr>',
);
// Wrapper close.
$form['sna_blocks_wrapper_close'] = array(
'#markup' => '</div>',
);
}