oliverdavies.uk-drupal-old/web/modules/custom/opdavies_blog/opdavies_blog.install
Oliver Davies 9b1a8fb3be Rename and re-organise custom modules
- Rename `opd_talks` to `opdavies_talks`
- Rename `custom` to `opdavies_blog`
2020-08-24 10:27:49 +01:00

18 lines
362 B
Plaintext

<?php
declare(strict_types=1);
use Drupal\opdavies_blog\Repository\PostRepository;
/**
* Mark existing blog posts as sent to social media.
*/
function opdavies_blog_update_8001(): void {
$posts = \Drupal::service(PostRepository::class)->getAll();
foreach ($posts as $post) {
$post->set('field_sent_to_social_media', TRUE);
$post->save();
}
}