You are here

function _tca_node_get_disabled_types in Token Content Access 8

Same name and namespace in other branches
  1. 2.0.x modules/tca_node/tca_node.module \_tca_node_get_disabled_types()

Get TCA disabled node types.

2 calls to _tca_node_get_disabled_types()
tca_node_query_search_node_search_alter in modules/tca_node/tca_node.module
Implements hook_query_TAG_alter().
tca_node_views_query_alter in modules/tca_node/tca_node.module
Implements hook_views_query_alter().

File

modules/tca_node/tca_node.module, line 16
Contains tca_node.module.

Code

function _tca_node_get_disabled_types() {
  $types = \Drupal::entityTypeManager()
    ->getStorage('node_type')
    ->loadMultiple();
  $settings_manager = \Drupal::service('tca.tca_settings_manager');
  $disabled_types = [];
  foreach ($types as $node_type_id => $definition) {
    $settings = $settings_manager
      ->loadSettingsAsConfig('node_type', $node_type_id);
    if (!$settings
      ->get('active')) {
      $disabled_types[] = $node_type_id;
    }
  }
  return $disabled_types;
}