You are here

private function ContentEntityViewModesExtractor::isChildOfSupportedClass in Acquia Content Hub 8

Checks whether the given class is supported for normalization.

Parameters

mixed $data: Data to normalize.

Return value

bool TRUE if is child of supported class.

1 call to ContentEntityViewModesExtractor::isChildOfSupportedClass()
ContentEntityViewModesExtractor::getRenderedViewModes in src/Normalizer/ContentEntityViewModesExtractor.php
Renders all the view modes that are configured to be rendered.

File

src/Normalizer/ContentEntityViewModesExtractor.php, line 177

Class

ContentEntityViewModesExtractor
Extracts the rendered view modes from a given ContentEntity Object.

Namespace

Drupal\acquia_contenthub\Normalizer

Code

private function isChildOfSupportedClass($data) {

  // If we aren't dealing with an object that is not supported return
  // now.
  if (!is_object($data)) {
    return FALSE;
  }
  $supported = (array) $this->supportedInterfaceOrClass;
  return (bool) array_filter($supported, function ($name) use ($data) {
    return $data instanceof $name;
  });
}