You are here

function colors_get_config_keys in Colors 8

Retrieve all possible config entity keys for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The current entity.

Return value

array

2 calls to colors_get_config_keys()
colors_colors_classes in ./colors.module
Implements hook_colors_classes().
colors_colors_palette in ./colors.module
Implements hook_colors_palette().

File

./colors.module, line 130
Controls assigning colors to entities.

Code

function colors_get_config_keys($entity) {
  $types = [];

  /** @var \Drupal\Core\Entity\EntityInterface $entity */
  switch ($entity
    ->getEntityTypeId()) {
    case 'node':
      $types[] = 'node.' . $entity
        ->bundle();
      break;
    case 'taxonomy_vocabulary':
      $types[] = 'vocabulary';
      break;
    case 'user':
      $types[] = 'user_current';
      $types[] = 'user_role';
      $types[] = 'user';
      break;
  }
  return $types;
}