You are here

private function MailchimpCampaignForm::getEntitiesForContentImport in Mailchimp 8

Same name and namespace in other branches
  1. 2.x modules/mailchimp_campaign/src/Form/MailchimpCampaignForm.php \Drupal\mailchimp_campaign\Form\MailchimpCampaignForm::getEntitiesForContentImport()

Returns an array of entities based on data from entity_get_info().

Filters out entities that do not contain a title field, as they cannot be used to import content into templates.

Return value

array Filtered entities from entity_get_info().

1 call to MailchimpCampaignForm::getEntitiesForContentImport()
MailchimpCampaignForm::getEntityImportFormElements in modules/mailchimp_campaign/src/Form/MailchimpCampaignForm.php
Gets form elements used in the entity import feature.

File

modules/mailchimp_campaign/src/Form/MailchimpCampaignForm.php, line 686

Class

MailchimpCampaignForm
Form controller for the MailchimpCampaign entity edit form.

Namespace

Drupal\mailchimp_campaign\Form

Code

private function getEntitiesForContentImport() {
  $entity_info = $this->entityTypeManager
    ->getDefinitions();
  $filtered_entities = [];
  foreach ($entity_info as $key => $entity) {
    $entity_keys = $entity
      ->getKeys();
    foreach ($entity_keys as $entity_key => $value) {
      if ($value == 'title') {
        $filtered_entities[$key] = $entity;
        continue;
      }
    }
  }
  return $filtered_entities;
}