function file_post_update_add_playsinline
Adds a value for the 'playsinline' setting of the 'file_video' formatter.
File
-
core/
modules/ file/ file.post_update.php, line 26
Code
function file_post_update_add_playsinline(array &$sandbox = []) : ?TranslatableMarkup {
/** @var \Drupal\Core\Config\Entity\ConfigEntityUpdater $config_entity_updater */
$config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class);
return $config_entity_updater->update($sandbox, 'entity_view_display', function (EntityViewDisplayInterface $display) {
$needs_update = FALSE;
$components = $display->getComponents();
foreach ($components as $name => $component) {
if (isset($component['type']) && $component['type'] === 'file_video') {
$needs_update = TRUE;
$component['settings']['playsinline'] = FALSE;
$display->setComponent($name, $component);
}
}
return $needs_update;
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.