function img_assist_thumbs in Image Assist 6.2
Same name and namespace in other branches
- 5.3 img_assist.module \img_assist_thumbs()
- 5 img_assist.module \img_assist_thumbs()
- 5.2 img_assist.module \img_assist_thumbs()
- 6 img_assist.module \img_assist_thumbs()
Load the thumbnail display pane.
Loads a View displaying the thumbnails. The view name is picked from the third path argument and any remaining arguments are used as arguments to the view. Module developers may add options to img_assist_header_form using hook_form_alter() if they wish to use custom views and/or arguments.
Related topics
1 string reference to 'img_assist_thumbs'
- img_assist_menu in ./
img_assist.module - Implementation of hook_menu().
File
- ./
img_assist.module, line 817 - Image Assist module
Code
function img_assist_thumbs() {
global $user;
if (module_exists('image') && module_exists('views')) {
$view_name = arg(2) != '' ? arg(2) : 'img_assist_browser';
// Get view arguments from path.
$args = explode('/', $_GET['q']);
$args = array_slice($args, 3);
// Check sanity and permissions for the 'img_assist_browser' view.
if ($view_name == 'img_assist_browser') {
if (empty($args[0]) || !user_access('access all images')) {
$args[0] = $user->uid;
}
if (isset($args[1])) {
$args[1] = (int) $args[1];
}
}
$view = views_get_view($view_name);
if ($view) {
$view_output = $view
->execute_display(NULL, $args);
if (empty($view_output)) {
$output = t('No images were found. Please upload a new image or browse images by a different category.');
}
else {
$output = $view_output;
}
}
else {
$output = t('Error: The specified view was not found.');
}
}
else {
$output = t('The Image and Views modules must be enabled to use Image assist.');
}
echo theme('img_assist_page', $output, array(
'id' => 'img_assist_thumbs',
'onload' => 'parent.initThumbs();',
'class' => 'img_assist',
));
exit;
}