You are here

public static function CommentNotifySettings::getCommentFieldIdentifier in Comment Notify 8

Get the field identifier machine name for a specific comment from config.

Returns the machine name of field identifier from bundle_types config for a specific comment.

Parameters

\Drupal\Core\Entity\EntityInterface $comment: The comment entity.

Return value

string Identifier for the comment field, formatted: [entity_type]--[bundle]--[field_name].

2 calls to CommentNotifySettings::getCommentFieldIdentifier()
comment_notify_form_comment_form_alter in ./comment_notify.module
Add the comment_notify fields in the comment form.
_comment_notify_mailalert in ./comment_notify.module
Private function to send the notifications.

File

src/Form/CommentNotifySettings.php, line 339

Class

CommentNotifySettings
Settings form for the Comment Notify module.

Namespace

Drupal\comment_notify\Form

Code

public static function getCommentFieldIdentifier(EntityInterface $comment) {
  $comment_on_entity_type = $comment
    ->getCommentedEntityTypeId();
  $comment_on_bundle_type = $comment
    ->getCommentedEntity()
    ->bundle();
  $comment_on_field_name = $comment
    ->getFieldName();
  $comment_on_identifier = implode('--', [
    $comment_on_entity_type,
    $comment_on_bundle_type,
    $comment_on_field_name,
  ]);
  return $comment_on_identifier;
}