Active
Project:
Gallery Assist Views
Version:
6.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Support request
Assigned:
Reporter:
Created:
2 Jun 2010 at 09:34 UTC
Updated:
20 Dec 2011 at 19:17 UTC
Hello to everyone! I want to share with views-preset to show all galleries in one page. It's very simple, but for new users (as I am) it can be usefull.
$view = new view;
$view->name = 'Gall';
$view->description = 'Gall';
$view->tag = 'Gall';
$view->view_php = '';
$view->base_table = 'gallery_assist_item';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Gallery', 'default');
$handler->override_option('relationships', array(
'nid' => array(
'label' => 'Gallery Assist',
'required' => 1,
'id' => 'nid',
'table' => 'gallery_assist_item',
'field' => 'nid',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node_revisions',
'field' => 'title',
'relationship' => 'nid',
),
'tpath' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'tpath',
'table' => 'gallery_assist_item',
'field' => 'tpath',
'relationship' => 'none',
'linked_to' => '0',
),
'name' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'nid',
),
'gref' => array(
'id' => 'gref',
'table' => 'gallery_assist_item',
'field' => 'gref',
),
));
$handler->override_option('sorts', array(
'timestamp' => array(
'order' => 'DESC',
'granularity' => 'minute',
'id' => 'timestamp',
'table' => 'node_revisions',
'field' => 'timestamp',
'relationship' => 'nid',
),
));
$handler->override_option('filters', array(
'cover' => array(
'operator' => '=',
'value' => array(
'value' => '1',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'cover',
'table' => 'gallery_assist_item',
'field' => 'cover',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Галереи');
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 3);
$handler->override_option('use_pager', 'mini');
$handler->override_option('style_plugin', 'image_gallery');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => 'ul',
));
$handler = $view->new_display('page', 'Страница', 'page_1');
$handler->override_option('path', 'gallery');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Галерея',
'description' => '',
'weight' => '0',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comments
Comment #1
bclinton commentedI found this very useful. Thank you.
It should probably be included with the module, much like Views Gallery includes default views.
Comment #2
mbequelman commentedThis is exactly what I was looking for, but where do I include this code?
Comment #3
jcmc commentedHello M,
simply use the import mechanism from views module.
Regards
Juan Carlos
Comment #4
Nicolas Ramirez commentedBut, if the galery is empty?
Maybe you can set a default cover (with counter 0), and when you get in the gallery show a little text like "Your gallery is empty. Add some photos!".
Comment #5
thinguy commentedAny way to get some space between the images. Mine are overlapping
Comment #6
Nicolas Ramirez commentedTo get some space between the images you have to change the view style to grid.
Comment #7
haggis85 commentedid like to use this too but i get an error:
* Das Design-Plugin image_gallery ist nicht verfügbar.
* Die Feld-Behandlungsroutine gallery_assist_item.tpath ist nicht verfügbar.
* Die Feld-Behandlungsroutine gallery_assist_item.gref ist nicht verfügbar.
* Das Design-Plugin image_gallery ist nicht verfügbar.
* Die Feld-Behandlungsroutine gallery_assist_item.tpath ist nicht verfügbar.
* Die Feld-Behandlungsroutine gallery_assist_item.gref ist nicht verfügbar.
* Die Ansicht konnte nicht importiert werden.
what does that mean?
Thanks haggis85
Comment #8
captix commented* Field handler gallery_assist_item.tpath is not available.
* Field handler gallery_assist_item.gref is not available.
* Field handler gallery_assist_item.tpath is not available.
* Field handler gallery_assist_item.gref is not available.
* Unable to import view.
:( whats the problem
Comment #9
summit commentedSubscribing, greetings, Martijn
Comment #10
franzkewd commentedSubscribe
Comment #11
Juan C commentedAnybody? I need this for Views 3 as well.
Comment #12
hristos commentedI have the same problem How resolve please
* Field handler gallery_assist_item.tpath is not available.
* Field handler gallery_assist_item.gref is not available.
* Field handler gallery_assist_item.tpath is not available.
* Field handler gallery_assist_item.gref is not available.
* Unable to import view.
Comment #13
hexen commentedTry this, my own.
But be sure u have latest dev 2.x