You are here

function lightning_workflow_preprocess_field in Lightning Workflow 8.2

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

Implements template_preprocess_field().

File

./lightning_workflow.module, line 73
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']);
    }
  }
}