protected function actions($entity) {
    $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId());
    $latest_revision_id = $storage->getLatestTranslationAffectedRevisionId($entity->id(), $entity->language()->getId());

    if ($latest_revision_id == NULL || !$this->moderationInfo || !$this->moderationInfo->isModeratedEntity($entity)) {
      return [];
    }

    $state = $this->moderationInfo->getWorkflowForEntity($entity)->getTypePlugin()->getState($entity->moderation_state->value);
    $element['status'] = [
      '#type' => 'item',
      '#markup' => $entity->isNew() || !$this->moderationInfo->isDefaultRevisionPublished($entity) ? $this->t('of unpublished @entity_type', ['@entity_type' => strtolower($entity->type->entity->label())]) : $this->t('of published @entity_type', ['@entity_type' => strtolower($entity->type->entity->label())]),
      '#weight' => 200,
      '#wrapper_attributes' => [
        'class' => ['status'],
      ],
      '#access' => !$state->isDefaultRevisionState(),
    ];

    $element['moderation_state_current'] = [
      '#type' => 'item',
      '#markup' => $state->label(),
      '#weight' => 210,
      '#wrapper_attributes' => [
        'class' => ['status', $state->id()],
      ],
    ];

    if ($this->moderationInfo->hasPendingRevision($entity)) {
      $route_info = Url::fromRoute('node.revision_revert_default_confirm', [
        'node' => $entity->id(),
        'node_revision' => $entity->getRevisionId(),
      ]);
      if ($this->request->query->has('destination')) {
        $query = $route_info->getOption('query');
        $query['destination'] = $this->request->query->get('destination');
        $route_info->setOption('query', $query);
      }

      $element['revert_to_default'] = [
        '#type' => 'link',
        '#title' => $this->t('Revert to default revision'),
        '#access' => $this->nodeRevisionAccess->checkAccess($entity, $this->currentUser, 'update'),
        '#weight' => 101,
        '#attributes' => [
          'class' => ['button', 'button--danger'],
        ],
      ];
      $element['revert_to_default']['#url'] = $route_info;
    }

    return $element;
  }
protected function actions($entity) {
    $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId());
    $latest_revision_id = $storage->getLatestTranslationAffectedRevisionId($entity->id(), $entity->language()->getId());

    if ($latest_revision_id == NULL || !$this->moderationInfo || !$this->moderationInfo->isModeratedEntity($entity)) {
      return [];
    }

    $state = $this->moderationInfo->getWorkflowForEntity($entity)->getTypePlugin()->getState($entity->moderation_state->value);
    $element['status'] = [
      '
      '
      '
      '
        'class' => ['status'],
      ],
      '
    ];

    $element['moderation_state_current'] = [
      '
      '
      '
      '
        'class' => ['status', $state->id()],
      ],
    ];

    if ($this->moderationInfo->hasPendingRevision($entity)) {
      $route_info = Url::fromRoute('node.revision_revert_default_confirm', [
        'node' => $entity->id(),
        'node_revision' => $entity->getRevisionId(),
      ]);
      if ($this->request->query->has('destination')) {
        $query = $route_info->getOption('query');
        $query['destination'] = $this->request->query->get('destination');
        $route_info->setOption('query', $query);
      }

      $element['revert_to_default'] = [
        '
        '
        '
        '
        '
          'class' => ['button', 'button--danger'],
        ],
      ];
      $element['revert_to_default']['
    }

    return $element;
  }
protected function actions ( $ entity ) { $ storage = $ this -> entityTypeManager -> getStorage ( $ entity -> getEntityTypeId ( ) ) ; $ latest_revision_id = $ storage -> getLatestTranslationAffectedRevisionId ( $ entity -> id ( ) , $ entity -> language ( ) -> getId ( ) ) ; if ( $ latest_revision_id == NULL || ! $ this -> moderationInfo || ! $ this -> moderationInfo -> isModeratedEntity ( $ entity ) ) { return [ ] ; } $ state = $ this -> moderationInfo -> getWorkflowForEntity ( $ entity ) -> getTypePlugin ( ) -> getState ( $ entity -> moderation_state -> value ) ; $ element [ 'status' ] = [ '#type' => 'item' , '#markup' => $ entity -> isNew ( ) || ! $ this -> moderationInfo -> isDefaultRevisionPublished ( $ entity ) ? $ this -> t ( 'of unpublished @entity_type' , [ '@entity_type' => strtolower ( $ entity -> type -> entity -> label ( ) ) ] ) : $ this -> t ( 'of published @entity_type' , [ '@entity_type' => strtolower ( $ entity -> type -> entity -> label ( ) ) ] ) , '#weight' => 200 , '#wrapper_attributes' => [ 'class' => [ 'status' ] , ] , '#access' => ! $ state -> isDefaultRevisionState ( ) , ] ; $ element [ 'moderation_state_current' ] = [ '#type' => 'item' , '#markup' => $ state -> label ( ) , '#weight' => 210 , '#wrapper_attributes' => [ 'class' => [ 'status' , $ state -> id ( ) ] , ] , ] ; if ( $ this -> moderationInfo -> hasPendingRevision ( $ entity ) ) { $ route_info = Url :: fromRoute ( 'node.revision_revert_default_confirm' , [ 'node' => $ entity -> id ( ) , 'node_revision' => $ entity -> getRevisionId ( ) , ] ) ; if ( $ this -> request -> query -> has ( 'destination' ) ) { $ query = $ route_info -> getOption ( 'query' ) ; $ query [ 'destination' ] = $ this -> request -> query -> get ( 'destination' ) ; $ route_info -> setOption ( 'query' , $ query ) ; } $ element [ 'revert_to_default' ] = [ '#type' => 'link' , '#title' => $ this -> t ( 'Revert to default revision' ) , '#access' => $ this -> nodeRevisionAccess -> checkAccess ( $ entity , $ this -> currentUser , 'update' ) , '#weight' => 101 , '#attributes' => [ 'class' => [ 'button' , 'button--danger' ] , ] , ] ; $ element [ 'revert_to_default' ] [ '#url' ] = $ route_info ; } return $ element ; }
{@inheritdoc}
{