You are here

function _activity_logger_get_content_entities in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  2. 8.2 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  3. 8.3 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  4. 8.4 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  5. 8.5 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  6. 8.6 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  7. 8.7 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  8. 8.8 modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  9. 10.3.x modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  10. 10.0.x modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  11. 10.1.x modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()
  12. 10.2.x modules/custom/activity_logger/activity_logger.module \_activity_logger_get_content_entities()

Helper function to get the content entity data.

Return value

array Entity content data.

1 call to _activity_logger_get_content_entities()
activity_logger_form_message_template_form_alter in modules/custom/activity_logger/activity_logger.module
Implements hook_form_FORM_ID_alter() for message_template_form().

File

modules/custom/activity_logger/activity_logger.module, line 35
Contains activity_logger.module..

Code

function _activity_logger_get_content_entities() {
  $entitity_type_manager = \Drupal::service('entity_type.manager');
  $options = [];
  foreach ($entitity_type_manager
    ->getDefinitions() as $entity_id => $entity_type) {
    if ($entity_type instanceof ContentEntityTypeInterface && $entity_id !== 'activity' && $entity_id !== 'message' && $entity_id !== 'message_template') {
      $entity_type_bundle_info = \Drupal::service('entity_type.bundle.info');
      $config_entity_bundles = $entity_type_bundle_info
        ->getBundleInfo($entity_type
        ->id());
      foreach ($config_entity_bundles as $key => $value) {

        // Dot character in key names is not allowed in config, so we use "-".
        $options[$entity_id . '-' . $key] = $entity_type
          ->getLabel() . ': ' . $value['label'];
      }
    }
  }
  return $options;
}