-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from openeuropa/OPENEUROPA-2416
OPENEUROPA-2416: Allow to define which view modes are embedable.
- Loading branch information
Showing
16 changed files
with
472 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Post update functions for OpenEuropa Media module. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
use Drupal\Core\Entity\Entity\EntityViewDisplay; | ||
|
||
/** | ||
* Make view modes that are already available embeddable by default. | ||
*/ | ||
function oe_media_embed_post_update_00001(): void { | ||
$available_view_display_ids = \Drupal::entityQuery('entity_view_display') | ||
->condition('targetEntityType', 'media') | ||
->condition('status', TRUE) | ||
->execute(); | ||
$available_view_displays = EntityViewDisplay::loadMultiple($available_view_display_ids); | ||
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */ | ||
foreach ($available_view_displays as $view_display) { | ||
if ($view_display->getThirdPartySetting('oe_media_embed', 'embeddable') === NULL) { | ||
$view_display->setThirdPartySetting('oe_media_embed', 'embeddable', TRUE); | ||
$view_display->save(); | ||
} | ||
} | ||
} |
Oops, something went wrong.