diff --git a/.gitignore b/.gitignore index af14085..02760d9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ !/scripts/ !/slides/ !/tools/ -!/web/modules/custom/ +!/web/modules/custom/** !/web/sites/default/environments/settings.*.php !/web/sites/default/settings.php !/web/themes/custom/** diff --git a/web/modules/custom/opd_talks/opd_talks.install b/web/modules/custom/opd_talks/opd_talks.install new file mode 100644 index 0000000..2db8d5a --- /dev/null +++ b/web/modules/custom/opd_talks/opd_talks.install @@ -0,0 +1,17 @@ +getAll() as $talk) { + $talk->set('field_type', 'talk'); + $talk->save(); + } +} diff --git a/web/modules/custom/opd_talks/opd_talks.services.yml b/web/modules/custom/opd_talks/opd_talks.services.yml new file mode 100644 index 0000000..c8aebb7 --- /dev/null +++ b/web/modules/custom/opd_talks/opd_talks.services.yml @@ -0,0 +1,3 @@ +services: + Drupal\opd_talks\Repository\TalkRepository: + autowire: true diff --git a/web/modules/custom/opd_talks/src/Repository/TalkRepository.php b/web/modules/custom/opd_talks/src/Repository/TalkRepository.php new file mode 100644 index 0000000..9977e27 --- /dev/null +++ b/web/modules/custom/opd_talks/src/Repository/TalkRepository.php @@ -0,0 +1,35 @@ +nodeStorage = $entityTypeManager->getStorage('node'); + } + + /** + * @return Collection|Talk[] + */ + public function getAll(bool $publishedOnly = FALSE): Collection { + $properties = ['type' => 'talk']; + + if ($publishedOnly) { + $properties['status'] = TRUE; + } + + return new Collection( + $this->nodeStorage->loadByProperties($properties) + ); + } + +}