How to get config entity value in drupal 8 | Stef Van Looveren

PHOTO EMBED

Mon Feb 06 2023 09:53:42 GMT+0000 (Coordinated Universal Time)

Saved by @ever_c0de

$storage = \Drupal::entityTypeManager()->getStorage('my_custom_config_entity');
$ids = \Drupal::entityQuery('my_custom_config_entity')->execute();
$List = $storage->loadMultiple($ids);
foreach($ids as $entity) {
  $id = $entity->id();
  $title = $entity->label();
  $custom_field = $entity->get('custom_field'); 
  // See how this line differs from content entities, who would have $entity->get('custom_field')->getString();
}
content_copyCOPY

https://stefvanlooveren.me/blog/how-get-config-entity-value-drupal-8