public function YoastSeoManager::getAvailableBundles in Real-time SEO for Drupal 8
Returns an array of available bundles Yoast SEO can be enabled for.
Parameters
string $entity_type: The entity.
Return value
array A list of available bundles as $id => $label.
1 call to YoastSeoManager::getAvailableBundles()
- YoastSeoManager::getEnabledBundles in src/
YoastSeoManager.php - Returns an array of bundles Yoast SEO has been enabled for.
File
- src/
YoastSeoManager.php, line 114
Class
- YoastSeoManager
- Class YoastSeoManager.
Namespace
Drupal\yoast_seoCode
public function getAvailableBundles($entity_type = 'node') {
$options = array();
// Retrieve the bundles the entity type contains.
$bundles = \Drupal::service('entity_type.bundle.info')
->getBundleInfo($entity_type);
foreach ($bundles as $bundle_id => $bundle_metadata) {
$options[$bundle_id] = $bundle_metadata['label'];
}
return $options;
}