2015-08-27 05:28:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Install, update and uninstall functions for the block_content module.
|
|
|
|
*/
|
|
|
|
|
2023-01-08 23:27:50 +00:00
|
|
|
use Drupal\Core\Entity\Form\RevisionDeleteForm;
|
|
|
|
use Drupal\Core\Entity\Form\RevisionRevertForm;
|
|
|
|
use Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider;
|
|
|
|
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
|
|
|
|
2018-07-16 22:43:44 +00:00
|
|
|
/**
|
Issue #3087644 by jibran, Berdir, alexpott, longwave, Wim Leers, amateescu, catch, xjm, larowlan, dpi, quietone: Remove Drupal 8 updates up to and including 88**
2020-01-24 23:52:03 +00:00
|
|
|
* Implements hook_update_last_removed().
|
2018-07-16 22:43:44 +00:00
|
|
|
*/
|
Issue #3087644 by jibran, Berdir, alexpott, longwave, Wim Leers, amateescu, catch, xjm, larowlan, dpi, quietone: Remove Drupal 8 updates up to and including 88**
2020-01-24 23:52:03 +00:00
|
|
|
function block_content_update_last_removed() {
|
|
|
|
return 8600;
|
2018-07-16 22:43:44 +00:00
|
|
|
}
|
2023-01-08 23:27:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update entity definition to handle revision routes.
|
|
|
|
*/
|
|
|
|
function block_content_update_10100(&$sandbox = NULL): TranslatableMarkup {
|
|
|
|
$entityDefinitionUpdateManager = \Drupal::entityDefinitionUpdateManager();
|
|
|
|
$definition = $entityDefinitionUpdateManager->getEntityType('block_content');
|
|
|
|
$routeProviders = $definition->get('route_provider');
|
|
|
|
$routeProviders['revision'] = RevisionHtmlRouteProvider::class;
|
|
|
|
$definition
|
|
|
|
->setFormClass('revision-delete', RevisionDeleteForm::class)
|
|
|
|
->setFormClass('revision-revert', RevisionRevertForm::class)
|
|
|
|
->set('route_provider', $routeProviders)
|
|
|
|
->setLinkTemplate('revision-delete-form', '/block/{block_content}/revision/{block_content_revision}/delete')
|
|
|
|
->setLinkTemplate('revision-revert-form', '/block/{block_content}/revision/{block_content_revision}/revert')
|
|
|
|
->setLinkTemplate('version-history', '/block/{block_content}/revisions');
|
|
|
|
$entityDefinitionUpdateManager->updateEntityType($definition);
|
|
|
|
return \t('Added revision routes to Custom block entity type.');
|
|
|
|
}
|
Issue #3272969 by LOBsTerr, smustgrave, metasim, larowlan, Abhijith S, Devashish Jangid, johnwebdev, vakulrai, tedbow, ranjith_kumar_k_u, nghai: Remove unique constraint on block content info field
2023-02-10 22:09:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the unique values constraint from block content info fields.
|
|
|
|
*/
|
|
|
|
function block_content_update_10200() {
|
|
|
|
$constraint = 'UniqueField';
|
|
|
|
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
|
|
|
|
$field_storage_definition = $definition_update_manager->getFieldStorageDefinition('info', 'block_content');
|
|
|
|
$constraints = $field_storage_definition->getConstraints();
|
|
|
|
if (isset($constraints[$constraint])) {
|
|
|
|
unset($constraints[$constraint]);
|
|
|
|
$field_storage_definition->setConstraints($constraints);
|
|
|
|
$definition_update_manager->updateFieldStorageDefinition($field_storage_definition);
|
|
|
|
}
|
|
|
|
}
|