function social_ajax_comments_ajax_comments_wrapper_id_alter in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_ajax_comments_wrapper_id_alter()
- 10.3.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_ajax_comments_wrapper_id_alter()
- 10.0.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_ajax_comments_wrapper_id_alter()
- 10.1.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_ajax_comments_wrapper_id_alter()
- 10.2.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_ajax_comments_wrapper_id_alter()
Implements hook_ajax_comments_wrapper_id_alter().
File
- modules/
custom/ social_ajax_comments/ social_ajax_comments.module, line 120 - Social AJAX comments module file.
Code
function social_ajax_comments_ajax_comments_wrapper_id_alter(&$wrapper_html_id, ContentEntityInterface $commented_entity, $field_name) {
if ($commented_entity instanceof Node && $field_name === 'field_topic_comments') {
$wrapper_html_id = Html::getId($commented_entity
->getEntityTypeId() . '-' . $commented_entity
->bundle() . '-' . $field_name);
}
if ($commented_entity instanceof Post && $field_name === 'field_post_comments') {
$wrapper_html_id = Html::getId($commented_entity
->getEntityTypeId() . '-' . $commented_entity
->bundle() . '-' . 'field_post_comments' . '-' . $commented_entity
->id());
}
}