Drupal 8: Set a Conditional class for Edge to Edge content types

/**
 * Implements template_preprocess_html().
 */
function template_preprocess_html(&$vars) {

  // Check to see if you are in a node.
  if ($node = \Drupal::routeMatch()->getParameter('node')) {

    // Get the node type.
    $type = $node->getType();

    // Define an array of edge to edge content types. 
    // (More can be added later)
    $flex_width_types = array(
      'modular_content',
    );

    // Add a body class to edge to edge content types.
    if (in_array($type, $flex_width_types)) {
      $vars['attributes']['class'][] = 'flex_width';
    }
  }
}