public function buildForm(array
$form, FormStateInterface
$form_state, WorkflowInterface
$workflow = NULL,
$entity_type_id = NULL
) { $this->workflow =
$workflow;
try { $this->entityType =
$this->entityTypeManager->
getDefinition($entity_type_id);
} catch (PluginNotFoundException
$e) { throw new NotFoundHttpException();
} $options =
$defaults =
[];
foreach ($this->bundleInfo->
getBundleInfo($this->entityType->
id()) as $bundle_id =>
$bundle) { // Check if moderation is enabled for this bundle on any workflow.
$moderation_enabled =
$this->moderationInformation->
shouldModerateEntitiesOfBundle($this->entityType,
$bundle_id);
// Check if moderation is enabled for this bundle on this workflow.
$workflow_moderation_enabled =
$this->workflow->
getTypePlugin()->
appliesToEntityTypeAndBundle($this->entityType->
id(),
$bundle_id);
// Only show bundles that are not enabled anywhere, or enabled on this
// workflow.
if (!
$moderation_enabled ||
$workflow_moderation_enabled) { // Add the bundle to the options if it's not enabled on a workflow,
// unless the workflow it's enabled on is this one.
$options[$bundle_id] =
[ 'title' =>
['data' =>
['#title' =>
$bundle['label'
]]],