You are here

entity_legal.post_update.php in Entity Legal 3.0.x

Same filename and directory in other branches
  1. 8.2 entity_legal.post_update.php
  2. 4.0.x entity_legal.post_update.php

Post-update scripts for Entity Legal module.

File

entity_legal.post_update.php
View source
<?php

/**
 * @file
 * Post-update scripts for Entity Legal module.
 */
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\entity_legal\EntityLegalDocumentInterface;

/**
 * Allow customizing the legal document title.
 */
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;
  });
}

Functions

Namesort descending Description
entity_legal_post_update_title_pattern Allow customizing the legal document title.