You are here

function photos_install in Album Photos 7.3

Same name and namespace in other branches
  1. 8.5 photos.install \photos_install()
  2. 8.4 photos.install \photos_install()
  3. 6.2 photos.install \photos_install()
  4. 6.0.x photos.install \photos_install()

Implements hook_install().

File

./photos.install, line 197
Install, update, and uninstall functions for the Album Photos module.

Code

function photos_install() {

  // Set default styles.
  $size = array(
    array(
      'style' => 'thumbnail',
      'name' => 'Thumb',
    ),
    array(
      'style' => 'medium',
      'name' => 'Medium',
    ),
    array(
      'style' => 'large',
      'name' => 'Large',
    ),
  );
  variable_set('photos_size', $size);
  variable_set('photos_pager_imagesize', $size[0]['style']);
  variable_set('photos_thumb_imagesize', $size[0]['style']);
  variable_set('photos_display_teaser_imagesize', $size[0]['style']);
  variable_set('photos_display_list_imagesize', $size[1]['style']);
  variable_set('photos_display_full_imagesize', $size[1]['style']);
  variable_set('photos_display_view_imagesize', $size[2]['style']);
  $values = array(
    array(
      'cid' => 0,
      'changed' => REQUEST_TIME,
      'type' => 'site_album',
      'value' => 0,
    ),
    array(
      'cid' => 0,
      'changed' => REQUEST_TIME,
      'type' => 'site_image',
      'value' => 0,
    ),
  );
  $query = db_insert('photos_count')
    ->fields(array(
    'cid',
    'changed',
    'type',
    'value',
  ));
  foreach ($values as $record) {
    $query
      ->values($record);
  }
  $query
    ->execute();

  // Ensure the photos node type is available.
  node_types_rebuild();
  $types = node_type_get_types();
  node_add_body_field($types['photos'], 'Album description');
}