You are here

function social_post_photo_update_10201 in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_post/modules/social_post_photo/social_post_photo.install \social_post_photo_update_10201()

Display field_album for post photo featured view mode.

File

modules/social_features/social_post/modules/social_post_photo/social_post_photo.install, line 135
The Social post photo installation.

Code

function social_post_photo_update_10201() {
  $config = \Drupal::configFactory()
    ->getEditable('core.entity_view_display.post.photo.featured');
  $content = $config
    ->get('content');
  $hidden = $config
    ->get('hidden');
  $content['field_album'] = [
    'type' => 'social_album_entity_reference_label',
    'weight' => 4,
    'region' => 'content',
    'label' => 'hidden',
    'settings' => [
      'link' => TRUE,
    ],
    'third_party_settings' => [],
  ];
  if (in_array('field_album', $hidden)) {
    unset($hidden['field_album']);
  }
  $config
    ->set('content', $content)
    ->set('hidden', $hidden)
    ->save();
}