You are here

function lightning_workflow_preprocess_field in Lightning Workflow 8.3

Same name and namespace in other branches
  1. 8 lightning_workflow.module \lightning_workflow_preprocess_field()
  2. 8.2 lightning_workflow.module \lightning_workflow_preprocess_field()

Implements template_preprocess_field().

File

./lightning_workflow.module, line 157
Provides workflow enhancements for Drupal.

Code

function lightning_workflow_preprocess_field(array &$variables) {
  if (\Drupal::moduleHandler()
    ->moduleExists('quickedit')) {
    quickedit_preprocess_field($variables);

    /** @var \Drupal\Core\Entity\EntityInterface $entity */
    $entity = $variables['element']['#object'];
    if ($entity instanceof EntityPublishedInterface && $entity
      ->isPublished() && RouteSubscriber::isViewing($entity)) {
      unset($variables['attributes']['data-quickedit-field-id']);
    }
  }
}