Mercurial > hg > isophonics-drupal-site
view core/modules/field_layout/field_layout.install @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line source
<?php /** * @file * Contains install and update functions for Field Layout. */ use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\field_layout\Display\EntityDisplayWithLayoutInterface; /** * Implements hook_install(). */ function field_layout_install() { // Ensure each entity display has a layout. $entity_save = function (EntityDisplayWithLayoutInterface $entity) { $entity->ensureLayout()->save(); }; array_map($entity_save, EntityViewDisplay::loadMultiple()); array_map($entity_save, EntityFormDisplay::loadMultiple()); // Invalidate the render cache since all content will now have a layout. Cache::invalidateTags(['rendered']); } /** * Implements hook_uninstall(). */ function field_layout_uninstall() { // Reset each entity display to use the one-column layout to best approximate // the absence of layouts. $entity_save = function (EntityDisplayWithLayoutInterface $entity) { $entity->setLayoutId('layout_onecol')->save(); }; array_map($entity_save, EntityViewDisplay::loadMultiple()); array_map($entity_save, EntityFormDisplay::loadMultiple()); // Invalidate the render cache since all content will no longer have a layout. Cache::invalidateTags(['rendered']); }