public function CommentNotifySettings::getCommentFieldIdentifiers in Comment Notify 8
Returns array of constructed machine names for each comment field.
Machine names used as array keys, checkbox labels used as values.
Return value
array Identifier for each comment field, formatted: [entity_type]--[bundle]--[field_name].
2 calls to CommentNotifySettings::getCommentFieldIdentifiers()
- CommentNotifySettings::buildForm in src/
Form/ CommentNotifySettings.php - Form constructor.
- CommentNotifySettings::submitForm in src/
Form/ CommentNotifySettings.php - Form submission handler.
File
- src/
Form/ CommentNotifySettings.php, line 311
Class
- CommentNotifySettings
- Settings form for the Comment Notify module.
Namespace
Drupal\comment_notify\FormCode
public function getCommentFieldIdentifiers() {
$bundle_checkboxes = [];
// Provide all comment fields as options.
$comment_field_map = $this->fieldManager
->getFieldMapByFieldType('comment');
foreach ($comment_field_map as $entity_type => $comment_fields) {
foreach ($comment_fields as $field_name => $field_info) {
foreach ($field_info['bundles'] as $field_bundle) {
$bundle_checkboxes[$entity_type . '--' . $field_bundle . '--' . $field_name] = Html::escape($entity_type . ': ' . $field_bundle . ': ' . $field_name);
}
}
}
return $bundle_checkboxes;
}