Problem/Motivation

Very long WorkflowState names can lead to WorkflowTransition names that exceed the 166-character limit for config names.
[EDIT The same problem can occur with Workflow name, and WorkflowState names themselves.]

The website encountered an unexpected error. Please try again later.

Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException: Configuration entity ID exceeds maximum allowed length of 166 characters. in Drupal\Core\Config\Entity\ConfigEntityStorage->save() (line 254 of core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php).

Drupal\Core\Entity\EntityBase->save() (Line: 609)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 140)
Drupal\workflow\Entity\WorkflowConfigTransition->save() (Line: 409)
Drupal\workflow\Entity\Workflow->createTransition('', '') (Line: 105)
Drupal\workflow\Form\WorkflowConfigTransitionRoleForm->buildRow(Object) (Line: 178)
Drupal\workflow\Form\WorkflowConfigTransitionFormBase->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('workflow_config_transition_permission_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  1. Create a workflow
  2. Create a workflow state that is very long
  3. Visit the workflow's "Transitions" tab

Proposed resolution

Truncate workflow transition configuration names that exceed 166 characters.

Remaining tasks

TBD

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Comments

ergonlogic created an issue. See original summary.

ergonlogic’s picture

Here's a patch that truncates transition IDs to the maximum length for an ID supported by config storage.

ergonlogic’s picture

Status: Active » Needs review
johnv’s picture

The same problem occurs when you create a Workflow with a long name.

Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException: Attempt to create a bundle with an ID longer than 32 characters: LONG_NAME in Drupal\Core\Entity\EntityBase->preSave() (line 396 of core\lib\Drupal\Core\Entity\EntityBase.php).

The patch will include a fix for WorkflowTypeForm with EntityTypeInterface::BUNDLE_MAX_LENGTH .

  • johnv committed e5f05193 on 8.x-1.x authored by ergonlogic
    Issue #3422048 by ergonlogic, johnv: Workflow config names can be too...
johnv’s picture

Issue summary: View changes
Status: Needs review » Fixed

The patch fixes similar problem in Workflow, State and Transition, using your code and better usage of the '#machine_name' element.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.