public function media_browser_plus_views_handler_area_navigation::exposed_form in Media Browser Plus 7.3
Form element to track the media basket.
Overrides views_handler::exposed_form
File
- views/
media_browser_plus_views_handler_area_navigation.inc, line 127 - Definition of media_browser_plus_views_handler_area_navigation.
Class
- media_browser_plus_views_handler_area_navigation
- MBP navigation handler.
Code
public function exposed_form(&$form, &$form_state) {
$root_folder = media_browser_plus_get_media_root_folder();
$folders = taxonomy_get_tree($root_folder->vid, $root_folder->tid);
$folder_options = array(
$root_folder->tid => $root_folder->name,
);
foreach ($folders as $folder) {
$folder_options[$folder->tid] = str_repeat('-', $folder->depth + 1) . $folder->name;
}
$default_folder = $root_folder->tid;
if (!empty($_COOKIE['Drupal_visitor_mbp_current_folder']) && (int) $_COOKIE['Drupal_visitor_mbp_current_folder'] > 0) {
$default_folder = (int) $_COOKIE['Drupal_visitor_mbp_current_folder'];
}
$form['mbp_current_folder'] = array(
'#type' => 'select',
'#title' => t('Folder'),
'#default_value' => $default_folder,
'#options' => $folder_options,
'#attributes' => array(
'class' => array(
'mbp-selected-folder',
),
),
);
// Add a checkbox to include subfolders in the view results.
$form['mbp_current_folder_include_subfolders'] = array(
'#type' => 'checkbox',
'#title' => t('Include subfolders in results'),
'#default_value' => 0,
);
}