protected function SettingsForm::getInstagramMediaTypes in Instagram Feeds 8
Gets Media types with Instagram source.
Return value
\Drupal\media\MediaTypeInterface[] Media Types options for Select form element.
1 call to SettingsForm::getInstagramMediaTypes()
- SettingsForm::buildMappingForm in src/
Form/ SettingsForm.php - Form builder for mapping between media entity and Instagram post.
File
- src/
Form/ SettingsForm.php, line 301
Class
- SettingsForm
- Defines an Instagram Feeds configuration form.
Namespace
Drupal\instagram_feeds\FormCode
protected function getInstagramMediaTypes() : array {
$options = [];
$media_types = \Drupal::entityTypeManager()
->getStorage('media_type')
->loadMultiple();
foreach ($media_types as $media_type) {
/** @var \Drupal\media\MediaTypeInterface $media_type */
if (in_array($media_type
->getSource()
->getPluginId(), [
'instagram',
'image',
])) {
$options[$media_type
->id()] = $media_type;
}
}
return $options;
}