You are here

function node_accessibility_node_update in Node Accessibility 8

Implements hook_ENTITY_TYPE_update().

File

./node_accessibility.module, line 158
Module file for the node accessibility project.

Code

function node_accessibility_node_update(\Drupal\node\Entity\Node $node) {
  $node_type = $node
    ->getType();
  $type_settings = \Drupal\node_accessibility\TypeSettingsStorage::loadAsArray($node_type);
  $quail_methods = \Drupal\quail_api\QuailApiSettings::get_validation_methods();
  if (!empty($type_settings['method']) && isset($quail_methods[$type_settings['method']])) {
    $method = $quail_methods[$type_settings['method']];

    // only perform automated validation if both the database is enabled and automatic is enabled.
    if (isset($method['automatic']) && $method['automatic'] && isset($method['database']) && $method['database']) {
      \Drupal\node_accessibility\PerformValidation::nodes([
        $node,
      ]);
    }
  }
}