Exemplo n.º 1
0
 /**
  * Returns an array of transition permissions.
  *
  * @return array
  *   The transition permissions.
  */
 public function transitionPermissions()
 {
     // @todo https://www.drupal.org/node/2779933 write a test for this.
     $perms = [];
     /* @var \Drupal\content_moderation\ModerationStateInterface[] $states */
     $states = ModerationState::loadMultiple();
     /* @var \Drupal\content_moderation\ModerationStateTransitionInterface $transition */
     foreach (ModerationStateTransition::loadMultiple() as $id => $transition) {
         $perms['use ' . $id . ' transition'] = ['title' => $this->t('Use the %transition_name transition', ['%transition_name' => $transition->label()]), 'description' => $this->t('Move content from %from state to %to state.', ['%from' => $states[$transition->getFromState()]->label(), '%to' => $states[$transition->getToState()]->label()])];
     }
     return $perms;
 }
 /**
  * Tests content moderation default schema.
  */
 public function testContentModerationDefaultConfig()
 {
     $this->installConfig(['content_moderation']);
     $typed_config = \Drupal::service('config.typed');
     $moderation_states = ModerationState::loadMultiple();
     foreach ($moderation_states as $moderation_state) {
         $this->assertConfigSchema($typed_config, $moderation_state->getEntityType()->getConfigPrefix() . '.' . $moderation_state->id(), $moderation_state->toArray());
     }
     $moderation_state_transitions = ModerationStateTransition::loadMultiple();
     foreach ($moderation_state_transitions as $moderation_state_transition) {
         $this->assertConfigSchema($typed_config, $moderation_state_transition->getEntityType()->getConfigPrefix() . '.' . $moderation_state_transition->id(), $moderation_state_transition->toArray());
     }
 }