You are here

public function Instances::listInstances in Smart Date 3.4.x

Same name and namespace in other branches
  1. 8.2 modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::listInstances()
  2. 3.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::listInstances()
  3. 3.0.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::listInstances()
  4. 3.1.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::listInstances()
  5. 3.2.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::listInstances()
  6. 3.3.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::listInstances()

Preparing output of instance listing either modal/Ajax or default.

Parameters

\Drupal\smart_date_recur\Entity\SmartDateRule $rrule: The rule object.

bool $modal: Whether or not to use a modal for display.

Return value

array|\Drupal\Core\Ajax\AjaxResponse The AJAX response object.

1 string reference to 'Instances::listInstances'
smart_date_recur.routing.yml in modules/smart_date_recur/smart_date_recur.routing.yml
modules/smart_date_recur/smart_date_recur.routing.yml

File

modules/smart_date_recur/src/Controller/Instances.php, line 449

Class

Instances
Provides listings of instances (with overrides) for a specified rule.

Namespace

Drupal\smart_date_recur\Controller

Code

public function listInstances(SmartDateRule $rrule, bool $modal = FALSE) {
  $this
    ->setSmartDateRule($rrule);
  if ($modal) {
    $this
      ->setUseAjax(TRUE);
  }
  $instancesList = $this
    ->listInstancesOutput();
  if ($modal) {
    $response = new AjaxResponse();
    $response
      ->addCommand(new OpenModalDialogCommand('Manage Instances', $instancesList, [
      'width' => '800',
    ]));
    return $response;
  }
  else {
    return $instancesList;
  }
}