private function MailchimpCampaignForm::buildEntityOptionList in Mailchimp 2.x
Same name and namespace in other branches
- 8 modules/mailchimp_campaign/src/Form/MailchimpCampaignForm.php \Drupal\mailchimp_campaign\Form\MailchimpCampaignForm::buildEntityOptionList()
Returns an options list 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.
Parameters
array $entity_info: Array of entities as returned by entity_get_info().
Return value
array Associative array of entity IDs to name.
1 call to MailchimpCampaignForm::buildEntityOptionList()
- 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 617
Class
- MailchimpCampaignForm
- Form controller for the MailchimpCampaign entity edit form.
Namespace
Drupal\mailchimp_campaign\FormCode
private function buildEntityOptionList(array $entity_info) {
$options = [
'' => '-- Select --',
];
foreach ($entity_info as $entity_id => $entity_data) {
// Exclude Mailchimp entities.
if (strpos($entity_id, 'mailchimp') === FALSE) {
$options[$entity_id] = $entity_data
->getLabel();
}
}
return $options;
}