Commit 56e7f27d authored by Ana Júlia Gomes Przsiczny's avatar Ana Júlia Gomes Przsiczny Committed by 장백호
Browse files

Issue #3258060: Fix coding standards problems in this module

parent bc30f53e
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -2,15 +2,19 @@

namespace Drupal\entity_delete;

use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Service for Deleting the entity.
 */
class DeleteEntity {

  use StringTranslationTrait;

  /**
   * Function to delete all the entities.
   *
   * @param int $delete_ids
   * @param array $delete_ids
   *   Entity ids to be deleted.
   * @param int $count
   *   Current row in the batch process.
@@ -23,8 +27,11 @@ class DeleteEntity {
   * @param string $context
   *   Context.
   */
  public static function deleteEntity($delete_ids, $count, $total_count, $entity, $bundle, &$context) {
    $context['message'] = t("Now processing :current_row of :highest_row", [':current_row' => $count, ":highest_row" => $total_count]);
  public static function deleteEntities(array $delete_ids, $count, $total_count, $entity, $bundle, &$context) {
    $context['message'] = t("Now processing :current_row of :highest_row", [
      ':current_row' => $count,
      ":highest_row" => $total_count,
    ]);
    $storage_handler = \Drupal::entityTypeManager()->getStorage($entity);
    $entities = $storage_handler->loadMultiple($delete_ids);
    $storage_handler->delete($entities);
@@ -46,7 +53,10 @@ class DeleteEntity {
  public static function deleteEntityFinishedCallback($success, $results, $operations) {
    if ($success) {
      if ($results['bundle'] == 'all') {
        $message = t('Successfully deleted @num @entity(s).', ['@num' => $results['count'], '@entity' => $results['entity']]);
        $message = t('Successfully deleted @num @entity(s).', [
          '@num' => $results['count'],
          '@entity' => $results['entity'],
        ]);
      }
      else {
        $message = t('Successfully deleted @num @entity(s) with @bundle.', [
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface;

/**
 * Class EntityDeleteConfirmationForm.
 * The EntityDeleteConfirmationForm class.
 *
 * @package Drupal\entity_delete\Form
 */
@@ -159,7 +159,7 @@ class EntityDeleteConfirmationForm extends FormBase {
          foreach ($batch_ids as $delete_ids) {
            $count_ids += count($delete_ids);
            $batch['operations'][] = [
              '\Drupal\entity_delete\DeleteEntity::deleteEntity',
              '\Drupal\entity_delete\DeleteEntity::deleteEntities',
              [
                $delete_ids,
                $count_ids,
+3 −3
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Class EntityDeleteForm.
 * The EntityDeleteForm class.
 *
 * @package Drupal\entity_delete\Form
 */
@@ -102,13 +102,13 @@ class EntityDeleteForm extends FormBase {
    // properties of what the entity to delete.
    $form['displays']['show'] = [
      '#type' => 'fieldset',
      '#title' => t('Entity Delete Settings'),
      '#title' => $this->t('Entity Delete Settings'),
      '#tree' => TRUE,
      '#attributes' => ['class' => ['container-inline']],
    ];
    $content_entity_types = [];
    $entity_type_definations = $this->entityTypeManager->getDefinitions();
    /* @var $definition \Drupal\Core\Entity\EntityTypeInterface */
    /** @var \Drupal\Core\Entity\EntityTypeInterface $definition */
    foreach ($entity_type_definations as $definition) {
      if ($definition instanceof ContentEntityType) {
        $content_entity_types[$definition->id()] = $definition->getLabel();