-
Notifications
You must be signed in to change notification settings - Fork 5
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 #595 from art-institute-of-chicago/feature/digital…
…-pub-media-sizes Digital publication media sizes [PUB-285]
- Loading branch information
Showing
12 changed files
with
126 additions
and
26 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
50 changes: 50 additions & 0 deletions
50
...migrations/2024_11_13_121456_update_sizes_of_digital_publication_article_media_blocks.php
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,50 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use App\Models\Vendor\Block; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
$types = [ | ||
'360_embed' => [], | ||
'artwork' => [], | ||
'image_slider' => [], | ||
'layered_image_viewer' => [], | ||
'media_embed' => [], | ||
'mirador_embed' => [], | ||
'table' => [], | ||
'video' => ['use_alt_background'], | ||
'vtour_embed' => [], | ||
]; | ||
|
||
foreach ($types as $type => $fieldsToSetToTrue) { | ||
// Find all blocks of digitalPublicationArticles | ||
$digiPubBlocks = Block::where('type', $type) | ||
->where('blockable_type', 'digitalPublicationArticles') | ||
->get(); | ||
|
||
// Update the content JSON column for image block on digital publication articles | ||
foreach ($digiPubBlocks as $block) { | ||
$content = $block->content; | ||
if ($content['size'] == 'm') { | ||
$content['size'] = 'l'; | ||
} | ||
|
||
foreach ($fieldsToSetToTrue as $field) { | ||
$content[$field] = true; | ||
} | ||
|
||
// Update the block with the new JSON | ||
$block->content = $content; | ||
$block->save(); | ||
} | ||
} | ||
} | ||
|
||
public function down(): void | ||
{ | ||
// There's no going back... | ||
} | ||
}; |
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
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