Created
July 31, 2020 05:08
-
-
Save deepakaryan1988/75bf92ed053f21c7d3e9be31baa15c44 to your computer and use it in GitHub Desktop.
D8-getting current moderation state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Drupal\grievance\Entity\GrievanceEntity; | |
$grievance_id = "4"; | |
$grievance = GrievanceEntity::load($grievance_id); | |
$grievance_vid = \Drupal::entityManager()->getStorage('grievance')->revisionIds($grievance); | |
$latest_revision_id = array_pop((array_slice($grievance_vid, -1))); | |
$grievance_revision = \Drupal::entityTypeManager() | |
->getStorage('grievance') | |
->loadRevision($latest_revision_id); | |
$current_state = $grievance_revision->get('moderation_state')->getValue()['0']['value']; | |
kint($current_state);exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment