You are here

function entity_legal_post_update_title_pattern in Entity Legal 8.2

Same name and namespace in other branches
  1. 4.0.x entity_legal.post_update.php \entity_legal_post_update_title_pattern()
  2. 3.0.x entity_legal.post_update.php \entity_legal_post_update_title_pattern()

Allow customizing the legal document title.

File

./entity_legal.post_update.php, line 14
Post-update scripts for Entity Legal module.

Code

function entity_legal_post_update_title_pattern(array &$sandbox) {
  \Drupal::classResolver(ConfigEntityUpdater::class)
    ->update($sandbox, ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, function (EntityLegalDocumentInterface $document) {
    $settings = $document
      ->get('settings');
    $settings['title_pattern'] = '[entity_legal_document:published-version:label]';
    $document
      ->set('settings', $settings);
    return TRUE;
  });
}