acquia_contenthub.entity_config is not respected by \Drupal\acquia_contenthub\EntityManager::getAllowedEntityTypes().

In fact, the only thing that respects acquia_contenthub.entity_config is \Drupal\acquia_contenthub\EntityManager::isEligibleEntity(). But that expects an actual Entity object to be passed.

So how is ResourceRoutes supposed to respect the configuration, if the internal API does not support this?

Also: why "allowed" vs "eligible"?

Comments

Wim Leers created an issue. See original summary.

abarrios’s picture

I see what you mean and you are right, there is a bug right there. Currently we do not have a method to get the list of configured entities from "acquia_contenthub.entity_config". The only one method that obtains the list from the configuration is isEligibleEntity().

The way how ResourceRoutes is obtaining the list of "configured" entities is actually wrong.

The list of configured entities should be obtained from the configuration, not from \Drupal\acquia_contenthub\EntityManager::getAllowedEntityTypes().

Also:
Allowed: List of entity types that are allowed to be configurable in the interface (excludes some types which cannot be enabled in the configuration).
Eligible: An entity type that has been selected to be exported to content hub.

Wim Leers’s picture

i.e. this configuration is not being respected:

entities:
  block_content:
    basic:
      enable_index: 0
      enable_viewmodes: 0
      rendering: {  }
  file:
    file:
      enable_index: 0
      enable_viewmodes: 0
      rendering: {  }
  node:
    article:
      enable_index: 1
      enable_viewmodes: 1
      rendering:
        rss: rss
    page:
      enable_index: 1
      enable_viewmodes: 0
      rendering:
        teaser: teaser
  taxonomy_term:
    tags:
      enable_index: 0
      enable_viewmodes: 0
      rendering: {  }
user_role: anonymous

… but also, that configuration has some significant flaws:

  1. it lists all entity types… (except some hardcoded excluded ones) but would fail if a new entity type is added
  2. it uses 0/1 instead of false/true
  3. it cannot list dependencies on the bundle entities

This should be converted to use config entities, for similar reasons as REST (see #2308745: Remove rest.settings.yml, use rest_resource config entities)

Wim Leers’s picture

#2: okay, great to see that confirmed!

(I wrote/posted #3 yesterday, but d.o went offline just as I tried posting it.)