Commit 42353cf4 authored by André Matheus Pedrosa's avatar André Matheus Pedrosa Committed by Joël Pittet
Browse files

Issue #3101650 by andregp, Suresh Prabhu Parkala, thalles, guilhermevp,...

Issue #3101650 by andregp, Suresh Prabhu Parkala, thalles, guilhermevp, adalbertov, joelpittet: Standards on Form/RequiredContextDelete.php
parent ff4e913b
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -15,21 +15,31 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class RequiredContextDelete extends ConfirmFormBase {

  /**
   * Creates a shared temporary storage for a collection.
   *
   * @var \Drupal\Core\TempStore\SharedTempStoreFactory
   */
  protected $tempstore;

  /**
   * The temporary id storage.
   *
   * @var string
   */
  // @codingStandardsIgnoreLine
  protected $tempstore_id;

  /**
   * The machine name.
   *
   * @var string
   */
  // @codingStandardsIgnoreLine
  protected $machine_name;

  /**
   * The id.
   *
   * @var int
   */
  protected $id;
@@ -42,7 +52,10 @@ abstract class RequiredContextDelete extends ConfirmFormBase {
  }

  /**
   * The constructor.
   *
   * @param \Drupal\Core\TempStore\SharedTempStoreFactory $tempstore
   *   The shared temporary storage.
   */
  public function __construct(SharedTempStoreFactory $tempstore) {
    $this->tempstore = $tempstore;
@@ -161,29 +174,35 @@ abstract class RequiredContextDelete extends ConfirmFormBase {
  /**
   * Document the route name and parameters for redirect after submission.
   *
   * @param $cached_values
   * @param mixed $cached_values
   *   The cached values.
   *
   * @return array
   *   In the format of
   *   return ['route.name', ['machine_name' => $this->machine_name, 'step' => 'step_name]];
   *   return [
   *     'route.name',
   *     ['machine_name' => $this->machine_name,'step' => 'step_name],
   *   ];
   */
  abstract protected function getParentRouteInfo($cached_values);

  /**
   * Custom logic for retrieving the contexts array from cached_values.
   *
   * @param $cached_values
   * @param mixed $cached_values
   *   The cache values.
   *
   * @return array
   *   Return an array.
   */
  abstract protected function getContexts($cached_values);

  /**
   * Custom logic for setting the contexts array in cached_values.
   *
   * @param $cached_values
   *
   * @param $contexts
   * @param mixed $cached_values
   *   The cache values.
   * @param mixed $contexts
   *   The contexts to set within the cached values.
   *
   * @return mixed