You are here

function entity_translation_unified_form_preprocess_html in Entity Translation Unified Form 8

Add a class only if the page is in add or edit mode.

File

./entity_translation_unified_form.module, line 41

Code

function entity_translation_unified_form_preprocess_html(&$variables) {
  $current_path = \Drupal::service('path.current')
    ->getPath();
  $patterns = "/node/add/*\n/node/*/edit";
  $match = \Drupal::service('path.matcher')
    ->matchPath($current_path, $patterns);
  if (!empty($match)) {
    $variables['attributes']['class'][] = 'etuf-sbs';

    // For css.
    $variables['attributes']['class'][] = 'sync';

    // For sync js.
  }
}