You are here

commerce_kickstart_social.install in Commerce Kickstart 7.2

Install, update, and uninstall functions for the Commerce Kiskcstart Social.

File

modules/commerce_kickstart/commerce_kickstart_social/commerce_kickstart_social.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the Commerce Kiskcstart Social.
 */

/**
 * Implements hook_install().
 *
 * Note that we cannot set the permissions for the providers, as we
 * don't have the consumer key and consumer secret, thus our exported
 * providers still don't have a record in the permission page. The admin
 * will need to manually set the permissions after completing the
 * registration of the provider form via admin/structure/oauthconnector.
 *
 * @see commerce_kickstart_install()
 */
function commerce_kickstart_social_install() {

  // Add service links permissions.
  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
    'access service links',
  ));
  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
    'access service links',
  ));
}

/**
 * Implements hook_enable().
 */
function commerce_kickstart_social_enable() {
  commerce_kickstart_rebuild_feature('commerce_kickstart_social');
  $default_theme = variable_get('theme_default', 'omega_kickstart');

  // Make sure that the region list is populated for our theme.
  drupal_static_reset();
  _block_rehash($default_theme);

  // Set the region of the connect-with-us menu block.
  $fields = array(
    'region' => 'footer_second',
    'status' => 1,
    'visibility' => 0,
    'pages' => '',
  );
  db_update('block')
    ->fields($fields)
    ->condition('module', 'menu')
    ->condition('delta', 'menu-social-connection')
    ->condition('theme', $default_theme)
    ->execute();

  // Add "email" field to OAuth connector.
  $values = array(
    'title' => 'email',
    'description' => '',
    'required' => 0,
  );
  oauthconnector_fields_save('email', $values);
}

/**
 * Rebuild Commerce Kickstart Social to ensure Service Links settings.
 */
function commerce_kickstart_social_update_7200() {

  // Proper fix for upgrade path from #2245219.
  if (!variable_get('service_links_node_view_modes')) {
    variable_set('service_links_node_view_modes', array(
      'full' => 'full',
      'teaser' => 0,
      'rss' => 0,
      'token' => 0,
      'product_list' => 0,
    ));
  }
}

Functions

Namesort descending Description
commerce_kickstart_social_enable Implements hook_enable().
commerce_kickstart_social_install Implements hook_install().
commerce_kickstart_social_update_7200 Rebuild Commerce Kickstart Social to ensure Service Links settings.