function AbrconfigForm::getBundlesList in Access by Reference 8.2
Function to get all bundles of the type 'node' so we can pre-fill the available options in the form
Parameters
string $type:
Return value
array
2 calls to AbrconfigForm::getBundlesList()
- AbrconfigForm::form in src/
Form/ AbrconfigForm.php - Gets the actual form array to be built.
- AbrconfigForm::getFieldsList in src/
Form/ AbrconfigForm.php
File
- src/
Form/ AbrconfigForm.php, line 45
Class
- AbrconfigForm
- Form handler for the Example add and edit forms.
Namespace
Drupal\access_by_ref\FormCode
function getBundlesList($type = 'node') {
/** @var $entityManager \Drupal\Core\Entity\EntityTypeBundleInfoInterface **/
$entityManager = \Drupal::service('entity_type.bundle.info');
$bundles = $entityManager
->getBundleInfo($type);
foreach ($bundles as $key => &$item) {
$bundles[$key] = $item['label'];
}
return $bundles;
}