You are here

function _node_gallery_create_default_relationship in Node Gallery 7

Create default Node Gallery relationship.

1 call to _node_gallery_create_default_relationship()
node_gallery_setup_content_types in ./node_gallery.install
Set up default content types.

File

./node_gallery.install, line 146
Install, update and uninstall functions for the node_gallery module.

Code

function _node_gallery_create_default_relationship() {
  $r = new NodeGalleryRelationshipType();
  $r->settings = node_gallery_api_relationship_type_settings_defaults();
  $r->settings['relationship_type']['gallery_types'] = array(
    NODE_GALLERY_DEFAULT_GALLERY_TYPE,
  );
  $r->settings['relationship_type']['item_types'] = array(
    NODE_GALLERY_DEFAULT_ITEM_TYPE,
  );
  $r->settings['view_modes']['full']['view'] = 'node_gallery_gallery_item_views:embed_1';
  $r->settings['view_modes']['teaser']['view'] = 'node_gallery_gallery_item_views:embed_6';
  $r->settings['item_view']['view_navigator_item_display'] = 'node_gallery_gallery_item_views:embed_5';
  $r->filefield_name = NODE_GALLERY_DEFAULT_MEDIA_FIELD;
  $r->label = $r->settings['relationship']['name'];
  $r
    ->save();
  variable_set('node_gallery_default_relationship_type_id', $r->id);
}