function agreement_get_agreement_options in Agreement 8.2
Same name and namespace in other branches
- 3.0.x agreement.module \agreement_get_agreement_options()
Gets the agreement types for views.
Return value
array An associative array of agreement types and labels.
1 string reference to 'agreement_get_agreement_options'
- agreement_views_data in ./
agreement.views.inc - Implements hook_views_data().
File
- ./
agreement.module, line 76 - Agreement module code - agreement.module.
Code
function agreement_get_agreement_options() {
$options = [];
try {
$agreements = \Drupal::entityTypeManager()
->getStorage('agreement')
->loadMultiple();
foreach ($agreements as $id => $agreement) {
$options[$agreement
->id()] = $agreement
->label();
}
} catch (InvalidPluginDefinitionException $e) {
\Drupal::messenger()
->addError(t('Unable to load agreement types.'));
}
return $options;
}