function getlocations_blocks_block_configure in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_blocks/getlocations_blocks.module \getlocations_blocks_block_configure()
Implements hook_block_configure().
This hook declares configuration options for blocks provided by this module.
File
- modules/
getlocations_blocks/ getlocations_blocks.module, line 72 - getlocations_blocks.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_blocks_block_configure($delta = '') {
$jq_upd = getlocations_check_jquery_version(TRUE);
drupal_add_js(GETLOCATIONS_BLOCKS_PATH . ($jq_upd ? '/js/getlocations_blocks_admin_1.min.js' : '/js/getlocations_blocks_admin.min.js'));
// The $delta parameter tells us which block is being configured.
$options = array(
'dropdown' => t('Dropdown'),
'autocomplete' => t('Autocomplete'),
);
$settings = getlocations_blocks_get_var();
$form = array();
$desc2 = array();
$desc2[0] = t('Please enable this view.');
$desc2[1] = t('This view is enabled.');
switch ($delta) {
case 'getlocations_blocks_city':
$view = 'getlocations_by_city';
$tarr = array(
'%t' => $desc2[0],
);
if (getlocations_blocks_check_view($view)) {
$tarr = array(
'%t' => $desc2[1],
);
}
$form['getlocations_blocks_city_path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#size' => 40,
'#description' => t("The path to the 'Getlocations by city' View. %t", $tarr),
'#default_value' => $settings['city_path'],
);
$form['getlocations_blocks_city_element'] = array(
'#type' => 'select',
'#title' => t('Selection method'),
'#options' => $options,
'#default_value' => $settings['city_element'],
);
$form['getlocations_blocks_city_filter'] = array(
'#type' => 'select',
'#title' => t('Filter on'),
'#options' => array(
'' => t('None'),
'field_name' => t('Field name'),
'bundle' => t('Content type'),
),
'#default_value' => $settings['city_filter'],
);
$fieldnames = getlocations_get_fieldnames();
$fieldnames = array(
'' => t('None'),
) + $fieldnames;
$form['getlocations_blocks_city_filter_fieldname'] = array(
'#type' => 'select',
'#title' => t('Field name'),
'#options' => $fieldnames,
'#default_value' => $settings['city_filter_fieldname'],
);
$bundles = getlocations_get_bundles();
$bundles = array(
'' => t('None'),
) + $bundles;
$form['getlocations_blocks_city_filter_bundle'] = array(
'#type' => 'select',
'#title' => t('Content type'),
'#options' => $bundles,
'#default_value' => $settings['city_filter_bundle'],
);
break;
case 'getlocations_blocks_province':
$view = 'getlocations_by_province';
$tarr = array(
'%t' => $desc2[0],
);
if (getlocations_blocks_check_view($view)) {
$tarr = array(
'%t' => $desc2[1],
);
}
$form['getlocations_blocks_province_path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#size' => 40,
'#description' => t("The path to the 'Getlocations by province' View. %t", $tarr),
'#default_value' => $settings['province_path'],
);
$form['getlocations_blocks_province_element'] = array(
'#type' => 'select',
'#title' => t('Selection method'),
'#options' => $options,
'#default_value' => $settings['province_element'],
);
$form['getlocations_blocks_province_filter'] = array(
'#type' => 'select',
'#title' => t('Filter on'),
'#options' => array(
'' => t('None'),
'field_name' => t('Field name'),
'bundle' => t('Content type'),
),
'#default_value' => $settings['province_filter'],
);
$fieldnames = getlocations_get_fieldnames();
$fieldnames = array(
'' => t('None'),
) + $fieldnames;
$form['getlocations_blocks_province_filter_fieldname'] = array(
'#type' => 'select',
'#title' => t('Field name'),
'#options' => $fieldnames,
'#default_value' => $settings['province_filter_fieldname'],
);
$bundles = getlocations_get_bundles();
$bundles = array(
'' => t('None'),
) + $bundles;
$form['getlocations_blocks_province_filter_bundle'] = array(
'#type' => 'select',
'#title' => t('Content type'),
'#options' => $bundles,
'#default_value' => $settings['province_filter_bundle'],
);
break;
case 'getlocations_blocks_postalcode':
$view = 'getlocations_bypostcode';
$tarr = array(
'%t' => $desc2[0],
);
if (getlocations_blocks_check_view($view)) {
$tarr = array(
'%t' => $desc2[1],
);
}
$form['getlocations_blocks_postalcode_path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#size' => 40,
'#description' => t("The path to the 'Getlocations by postalcode' View. %t", $tarr),
'#default_value' => $settings['postalcode_path'],
);
$form['getlocations_blocks_postalcode_element'] = array(
'#type' => 'select',
'#title' => t('Selection method'),
'#options' => $options,
'#default_value' => $settings['postalcode_element'],
);
$form['getlocations_blocks_postalcode_filter'] = array(
'#type' => 'select',
'#title' => t('Filter on'),
'#options' => array(
'' => t('None'),
'field_name' => t('Field name'),
'bundle' => t('Content type'),
),
'#default_value' => $settings['postalcode_filter'],
);
$fieldnames = getlocations_get_fieldnames();
$fieldnames = array(
'' => t('None'),
) + $fieldnames;
$form['getlocations_blocks_postalcode_filter_fieldname'] = array(
'#type' => 'select',
'#title' => t('Field name'),
'#options' => $fieldnames,
'#default_value' => $settings['postalcode_filter_fieldname'],
);
$bundles = getlocations_get_bundles();
$bundles = array(
'' => t('None'),
) + $bundles;
$form['getlocations_blocks_postalcode_filter_bundle'] = array(
'#type' => 'select',
'#title' => t('Content type'),
'#options' => $bundles,
'#default_value' => $settings['postalcode_filter_bundle'],
);
break;
case 'getlocations_blocks_country':
$view = 'getlocations_bycountry';
$tarr = array(
'%t' => $desc2[0],
);
if (getlocations_blocks_check_view($view)) {
$tarr = array(
'%t' => $desc2[1],
);
}
$form['getlocations_blocks_country_path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#size' => 40,
'#description' => t("The path to the 'Getlocations by country' View. %t", $tarr),
'#default_value' => $settings['country_path'],
);
$form['getlocations_blocks_country_element'] = array(
'#type' => 'select',
'#title' => t('Selection method'),
'#options' => $options,
'#default_value' => $settings['country_element'],
);
$form['getlocations_blocks_country_full'] = array(
'#type' => 'checkbox',
'#title' => t('Use full country list'),
'#default_value' => $settings['country_full'],
);
$form['getlocations_blocks_country_filter'] = array(
'#type' => 'select',
'#title' => t('Filter on'),
'#options' => array(
'' => t('None'),
'field_name' => t('Field name'),
'bundle' => t('Content type'),
),
'#default_value' => $settings['country_filter'],
);
$fieldnames = getlocations_get_fieldnames();
$fieldnames = array(
'' => t('None'),
) + $fieldnames;
$form['getlocations_blocks_country_filter_fieldname'] = array(
'#type' => 'select',
'#title' => t('Field name'),
'#options' => $fieldnames,
'#default_value' => $settings['country_filter_fieldname'],
);
$bundles = getlocations_get_bundles();
$bundles = array(
'' => t('None'),
) + $bundles;
$form['getlocations_blocks_country_filter_bundle'] = array(
'#type' => 'select',
'#title' => t('Content type'),
'#options' => $bundles,
'#default_value' => $settings['country_filter_bundle'],
);
break;
}
return $form;
}