You are here

social_post_photo.install in Open Social 8

The Social post photo installation.

File

modules/social_features/social_post/modules/social_post_photo/social_post_photo.install
View source
<?php

/**
 * @file
 * The Social post photo installation.
 */

/**
 * Install hook for Social Post Photo.
 */
function social_post_photo_install() {

  // Change post to photo.
  _social_post_photo_settype('post', 'photo');
}

/**
 * Uninstall hook for Social Post Photo.
 */
function social_post_photo_uninstall() {

  // Change photo to post.
  _social_post_photo_settype('photo', 'post');
  $configs = [
    'core.entity_form_display.post.photo.default',
    'core.entity_form_display.post.photo.group',
    'core.entity_form_display.post.photo.profile',
    'core.entity_view_display.post.photo.activity',
    'core.entity_view_display.post.photo.activity_comment',
    'core.entity_view_display.post.photo.default',
    'field.field.post.photo.field_post',
    'field.field.post.photo.field_post_comments',
    'field.field.post.photo.field_post_image',
    'field.field.post.photo.field_recipient_group',
    'field.field.post.photo.field_recipient_user',
    'field.field.post.photo.field_visibility',
    'field.storage.post.field_post_image',
    'image.style.social_post_photo',
    'social_post.post_type.photo',
  ];
  foreach ($configs as $config) {

    // Deleting config.
    \Drupal::configFactory()
      ->getEditable($config)
      ->delete();
  }
}

/**
 * Set the number of comments on Post Teaser and Full display.
 */
function social_post_photo_update_8001() {
  \Drupal::service('config.installer')
    ->installDefaultConfig('module', 'social_post_photo');
}

Functions

Namesort descending Description
social_post_photo_install Install hook for Social Post Photo.
social_post_photo_uninstall Uninstall hook for Social Post Photo.
social_post_photo_update_8001 Set the number of comments on Post Teaser and Full display.