You are here

function simple_node_importer_get_allowed_entity_type_list in Simple Node Importer 8

1 string reference to 'simple_node_importer_get_allowed_entity_type_list'
field.storage.node.field_select_entity_type.yml in config/install/field.storage.node.field_select_entity_type.yml
config/install/field.storage.node.field_select_entity_type.yml

File

./simple_node_importer.module, line 562
Simple node importer module file.

Code

function simple_node_importer_get_allowed_entity_type_list(FieldStorageConfig $definition, ContentEntityInterface $entity = NULL, $cacheable) {

  // Declare a variable for selected content type.
  $entity_type_selected = [];

  // Add a custom alignment option for Article nodes.
  if ($entity
    ->bundle() == 'simple_node') {

    // Get the list of all allowed content types.
    $entity_type_select = \Drupal::config('simple_node_importer.settings')
      ->get('entity_type_select');
    $entity_type_selected['_none'] = t("- Select a value -");
    if (!empty($entity_type_select)) {
      foreach ($entity_type_select as $key => $value) {
        if ($value) {
          $entity_type_selected[$key] = str_replace("_", " ", $value);
        }
      }
    }
  }
  return $entity_type_selected;
}