- 🇺🇸United States cedewey Denver, CO
I tried testing the patch but it did not apply.
2 out of 6 hunks failed.
Here is the contents of the src/Form/CommentNotifySettings.php.rej file
--- src/Form/CommentNotifySettings.php +++ src/Form/CommentNotifySettings.php @@ -2,6 +2,7 @@ namespace Drupal\comment_notify\Form; +use Drupal\comment\CommentInterface; use Drupal\Component\Utility\Html; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -94,22 +95,21 @@ class CommentNotifySettings extends ConfigFormBase { $entity_types = []; foreach ($bundle_checkboxes as $comment_field_identifier => $bundle_checkbox_label) { $comment_field_info = explode('--', $comment_field_identifier); - $entity_type = $comment_field_info[0]; - $entity_bundle = $comment_field_info[1]; - $field_name = $comment_field_info[2]; + [$entity_type, $entity_bundle, $field_name] = $comment_field_info; $entity_types[$entity_type][] = $comment_field_identifier; $comment_field = FieldConfig::loadByName($entity_type, $entity_bundle, $field_name); - if (in_array($entity_type . '--' . $entity_bundle . '--' . $field_name, $enabled_bundles) && $comment_field && $comment_field->getSetting('anonymous') == COMMENT_ANONYMOUS_MAYNOT_CONTACT) { - if (User::getAnonymousUser()->hasPermission('subscribe to comments')) { - // Provide a link if the field_ui module is installed. - if ($this->moduleHandler->moduleExists('field_ui')) { - $link = Link::fromTextAndUrl($comment_field_identifier, $comment_field->toUrl($entity_type . '-field-edit-form')); - $no_allowed_contact_info_field[] = $link->toString(); - } - else { - $no_allowed_contact_info_field[] = $comment_field_identifier; - } + if ($comment_field && + in_array($entity_type . '--' . $entity_bundle . '--' . $field_name, $enabled_bundles, TRUE) && + (int) $comment_field->getSetting('anonymous') === CommentInterface::ANONYMOUS_MAYNOT_CONTACT && + User::getAnonymousUser()->hasPermission('subscribe to comments')) { + // Provide a link if the field_ui module is installed. + if ($this->moduleHandler->moduleExists('field_ui')) { + $link = Link::fromTextAndUrl($comment_field_identifier, $comment_field->toUrl($entity_type . '-field-edit-form')); + $no_allowed_contact_info_field[] = $link->toString(); + } + else { + $no_allowed_contact_info_field[] = $comment_field_identifier; } } }
- Status changed to Needs work
about 1 year ago 5:24pm 6 October 2023 - 🇮🇳India SandeepSingh199
@cedewey Created a re-roll patch of entity_bundle.patch. Please take a look & let me know if you can successfully applied this patch.
- Status changed to Needs review
about 1 year ago 2:26pm 13 October 2023 - Status changed to Needs work
about 1 year ago 3:32pm 13 October 2023 - 🇺🇸United States cedewey Denver, CO
Thank you for rerolling this Sandeep. This feature looks promising. I like that there is still a default email field in case a site owner doesn't need different emails per entity type.
It would be helpful to still have a default subject line and email body. I recommend it including the current default values.