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

bclinton’s picture

I found this very useful. Thank you.

It should probably be included with the module, much like Views Gallery includes default views.

mbequelman’s picture

This is exactly what I was looking for, but where do I include this code?

jcmc’s picture

Hello M,

simply use the import mechanism from views module.

Regards
Juan Carlos

Nicolas Ramirez’s picture

But, 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!".

thinguy’s picture

Any way to get some space between the images. Mine are overlapping

Nicolas Ramirez’s picture

To get some space between the images you have to change the view style to grid.

haggis85’s picture

id 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

captix’s picture

* 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

summit’s picture

Subscribing, greetings, Martijn

franzkewd’s picture

Subscribe

Juan C’s picture

Anybody? I need this for Views 3 as well.

hristos’s picture

I 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.

hexen’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

Try this, my own.

$view = new view;
$view->name = 'Gall';
$view->description = 'Gall';
$view->tag = '';
$view->base_table = 'node';
$view->core = 6;
$view->api_version = '2';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Ustawienia domyślne', '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(
  'cover' => array(
    'label' => 'Obraz',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'absolute' => 0,
      'link_class' => '',
      'alt' => '',
      'rel' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'hide_alter_empty' => 1,
    'linked_to' => '1',
    'icformat' => 'none',
    'exclude' => 0,
    'id' => 'cover',
    'table' => 'gallery_assist_item',
    'field' => 'cover',
    'relationship' => 'nid',
  ),
  'pid' => array(
    'id' => 'pid',
    'table' => 'gallery_assist_item',
    'field' => 'pid',
  ),
));
$handler->override_option('sorts', array(
  'last_updated' => array(
    'id' => 'last_updated',
    'table' => 'node_comment_statistics',
    'field' => 'last_updated',
  ),
));
$handler->override_option('filters', array(
  'is_cover' => array(
    'id' => 'is_cover',
    'table' => 'gallery_assist_item',
    'field' => 'is_cover',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler = $view->new_display('page', 'Strona', 'page_1');
$handler->override_option('fields', array(
  'cover' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'absolute' => 0,
      'link_class' => '',
      'alt' => '',
      'rel' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'hide_alter_empty' => 1,
    'linked_to' => '1',
    'icformat' => '14',
    'exclude' => 0,
    'id' => 'cover',
    'table' => 'gallery_assist_item',
    'field' => 'cover',
    'relationship' => 'nid',
    'override' => array(
      'button' => 'Użyj domślnych',
    ),
  ),
  'pid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'absolute' => 0,
      'link_class' => '',
      'alt' => '',
      'rel' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'hide_alter_empty' => 1,
    'exclude' => 1,
    'id' => 'pid',
    'table' => 'gallery_assist_item',
    'field' => 'pid',
    'override' => array(
      'button' => 'Użyj domślnych',
    ),
    'relationship' => 'nid',
  ),
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '<div style="text-align: right;">
[cover]</br>[title]</div>',
      'make_link' => 0,
      'path' => '',
      'absolute' => 0,
      'link_class' => '',
      'alt' => '',
      'rel' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 1,
      'max_length' => '20',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'hide_alter_empty' => 1,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Użyj domślnych',
    ),
    'relationship' => 'nid',
  ),
));
$handler->override_option('filters', array(
  'is_cover' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'is_cover',
    'table' => 'gallery_assist_item',
    'field' => 'is_cover',
    'override' => array(
      'button' => 'Użyj domślnych',
    ),
    'relationship' => 'nid',
  ),
));
$handler->override_option('title', 'Galerie');
$handler->override_option('header', '');
$handler->override_option('header_format', '2');
$handler->override_option('header_empty', 0);
$handler->override_option('use_ajax', TRUE);
$handler->override_option('use_pager', 'mini');
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
  'columns' => '4',
  'alignment' => 'horizontal',
  'fill_single_line' => 1,
  'summary' => '',
));
$handler->override_option('row_options', array(
  'inline' => array(
    'cover' => 'cover',
  ),
  'separator' => '',
  'hide_empty' => 0,
));
$handler->override_option('path', 'galerie');
$handler->override_option('menu', array(
  'type' => 'normal',
  'title' => 'Galerie',
  'description' => 'Galerie studentów',
  'weight' => '0',
  'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));

But be sure u have latest dev 2.x