You are here

function _require_on_publish_entity_is_publishable in Require on Publish 8

Checks whether an entity type is publishable or not.

Parameters

string $entity_class: The class name.

Return value

bool Whether the entity can be published or not.

3 calls to _require_on_publish_entity_is_publishable()
require_on_publish_entity_type_alter in ./require_on_publish.module
Implements hook_entity_type_alter().
require_on_publish_form_alter in ./require_on_publish.module
Implements hook_form_alter().
require_on_publish_form_field_config_edit_form_alter in ./require_on_publish.module
Implements hook_form_FORM_ID_alter().

File

./require_on_publish.module, line 271
Module file for the Require on Publish module.

Code

function _require_on_publish_entity_is_publishable($entity_class) {
  if (!(new ReflectionClass($entity_class))
    ->implementsInterface('\\Drupal\\Core\\Entity\\EntityPublishedInterface')) {
    return FALSE;
  }
  return TRUE;
}