private function NodeViewCountSettingsForm::getNodeTypesOptions in Node view count 8
Get all possible node type names.
Data returned in format applicable for '#options' key of form element. Keys are ids of node types, values are labels (human readable names) of node types.
Return value
array All possible node type names for nodes.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 call to NodeViewCountSettingsForm::getNodeTypesOptions()
- NodeViewCountSettingsForm::buildForm in src/
Form/ NodeViewCountSettingsForm.php - Form constructor.
File
- src/
Form/ NodeViewCountSettingsForm.php, line 160
Class
- NodeViewCountSettingsForm
- Configure nodeviewcount settings.
Namespace
Drupal\nodeviewcount\FormCode
private function getNodeTypesOptions() {
$node_types_options = [];
/** @var \Drupal\node\NodeTypeInterface[] $node_types */
$node_types = $this->entityTypeManager
->getStorage('node_type')
->loadMultiple();
foreach ($node_types as $node_id => $node_type) {
$node_types_options[$node_id] = $node_type
->label();
}
return $node_types_options;
}