Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/content_moderation/src/ModerationInformation.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
52 if (!$entity instanceof ContentEntityInterface) { | 52 if (!$entity instanceof ContentEntityInterface) { |
53 return FALSE; | 53 return FALSE; |
54 } | 54 } |
55 | 55 |
56 return $this->shouldModerateEntitiesOfBundle($entity->getEntityType(), $entity->bundle()); | 56 return $this->shouldModerateEntitiesOfBundle($entity->getEntityType(), $entity->bundle()); |
57 } | |
58 | |
59 /** | |
60 * {@inheritdoc} | |
61 */ | |
62 public function isModeratedEntityType(EntityTypeInterface $entity_type) { | |
63 $bundles = $this->bundleInfo->getBundleInfo($entity_type->id()); | |
64 return !empty(array_column($bundles, 'workflow')); | |
57 } | 65 } |
58 | 66 |
59 /** | 67 /** |
60 * {@inheritdoc} | 68 * {@inheritdoc} |
61 */ | 69 */ |
204 | 212 |
205 /** | 213 /** |
206 * {@inheritdoc} | 214 * {@inheritdoc} |
207 */ | 215 */ |
208 public function getWorkflowForEntity(ContentEntityInterface $entity) { | 216 public function getWorkflowForEntity(ContentEntityInterface $entity) { |
209 $bundles = $this->bundleInfo->getBundleInfo($entity->getEntityTypeId()); | 217 return $this->getWorkflowForEntityTypeAndBundle($entity->getEntityTypeId(), $entity->bundle()); |
210 if (isset($bundles[$entity->bundle()]['workflow'])) { | 218 } |
211 return $this->entityTypeManager->getStorage('workflow')->load($bundles[$entity->bundle()]['workflow']); | 219 |
212 }; | 220 /** |
221 * {@inheritdoc} | |
222 */ | |
223 public function getWorkflowForEntityTypeAndBundle($entity_type_id, $bundle_id) { | |
224 $bundles = $this->bundleInfo->getBundleInfo($entity_type_id); | |
225 if (isset($bundles[$bundle_id]['workflow'])) { | |
226 return $this->entityTypeManager->getStorage('workflow')->load($bundles[$bundle_id]['workflow']); | |
227 } | |
213 return NULL; | 228 return NULL; |
214 } | 229 } |
215 | 230 |
216 /** | 231 /** |
217 * {@inheritdoc} | 232 * {@inheritdoc} |