class CommentDeleteSubmitter in Comment Delete 8
Submit callback handler for deleting comment.
@package Drupal\comment_delete
Hierarchy
- class \Drupal\Component\DependencyInjection\Container implements \Symfony\Component\DependencyInjection\ContainerInterface
- class \Drupal\Core\DependencyInjection\Container
- class \Drupal\comment_delete\CommentDeleteSubmitter
- class \Drupal\Core\DependencyInjection\Container
Expanded class hierarchy of CommentDeleteSubmitter
1 file declares its use of CommentDeleteSubmitter
File
- src/
CommentDeleteSubmitter.php, line 13
Namespace
Drupal\comment_deleteView source
class CommentDeleteSubmitter extends Container {
/**
* Submit handler for the comment delete form.
*
* @param array $form
* The form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
public static function submitForm(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\comment_delete\CommentDeleteManager $comment_delete_manager */
$comment_delete_manager = \Drupal::service('comment_delete.manager');
/** @var \Drupal\comment\Form\DeleteForm $form_object */
$form_object = $form_state
->getFormObject();
/** @var \Drupal\comment\Entity\Comment $comment */
$comment = $form_object
->getEntity();
$comment_delete_manager
->delete($comment, $form_state
->getValue('delete_operation'));
if ($comment_delete_manager
->isAjaxRequest()) {
// No redirect on Ajax request. Presumably the module or custom
// integration adding Ajax support to comments handles the Ajax response.
$form_state
->disableRedirect();
}
else {
$entity_type = $comment
->getCommentedEntityTypeId();
$form_state
->setRedirect("entity.{$entity_type}.canonical", [
$entity_type => $comment
->getCommentedEntityId(),
]);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommentDeleteSubmitter:: |
public static | function | Submit handler for the comment delete form. | |
Container:: |
protected | property | The aliases of the container. | |
Container:: |
protected | property | Whether the container parameters can still be changed. | |
Container:: |
protected | property | The currently loading services. | |
Container:: |
protected | property | The parameters of the container. | |
Container:: |
protected | property | The instantiated private services. | |
Container:: |
protected | property | The service definitions of the container. | |
Container:: |
protected | property | The instantiated services. | |
Container:: |
protected | function | Creates a service from a service definition. | 1 |
Container:: |
public | function | Gets a service. | 2 |
Container:: |
protected | function | Provides alternatives for a given array and key. | |
Container:: |
public | function | Gets a parameter. | |
Container:: |
protected | function | Provides alternatives in case a parameter was not found. | |
Container:: |
protected | function | Provides alternatives in case a service was not found. | |
Container:: |
public | function | Gets all defined service IDs. | |
Container:: |
public | function | Returns true if the given service is defined. | |
Container:: |
public | function | Checks if a parameter exists. | |
Container:: |
public | function | ||
Container:: |
public | function | Resets shared services from the container. | |
Container:: |
protected | function | Resolves arguments that represent services or variables to the real values. | 1 |
Container:: |
public | function |
Sets a service. Overrides Container:: |
|
Container:: |
public | function | Sets a parameter. | |
Container:: |
private | function | Ensure that cloning doesn't work. | |
Container:: |
public | function | Constructs a new Container instance. | 1 |
Container:: |
public | function |