You are here

function bibcite_entity_update_8023 in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/bibcite_entity.install \bibcite_entity_update_8023()

Add "Name" field to the Contributor entity default form mode and use "Parse name" widget for it.

File

modules/bibcite_entity/bibcite_entity.install, line 885
Module installation hooks implementation.

Code

function bibcite_entity_update_8023() {
  $config_name = 'core.entity_form_display.bibcite_contributor.bibcite_contributor.default';
  $config_factory = \Drupal::configFactory();
  $config = $config_factory
    ->getEditable($config_name);
  if (!$config
    ->isNew()) {
    $content = $config
      ->get('content');
    $content['name'] = [
      'type' => 'bibcite_parse_name',
      'region' => 'content',
      'weight' => -1,
      'settings' => [],
      'third_party_settings' => [],
    ];
    $config
      ->set('content', $content);
    $hidden = $config
      ->get('hidden');
    unset($hidden['name']);
    $config
      ->set('hidden', $hidden);
    $config
      ->save();
  }
}