function ajax_comments_field_formatter_third_party_settings_form in AJAX Comments 8
Implements hook_field_formatter_third_party_settings_form().
File
- ./
ajax_comments.module, line 354 - AJAX comments module file.
Code
function ajax_comments_field_formatter_third_party_settings_form(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
$element = [];
if ($field_definition
->getType() === 'comment') {
$ajax_comments_status = \Drupal::service('ajax_comments.field_settings_helper')
->isEnabled($plugin);
$element['enable_ajax_comments'] = [
'#type' => 'checkbox',
'#title' => t('Enable Ajax Comments'),
'#default_value' => $ajax_comments_status,
];
}
return $element;
}