destination example


function hook_user_login(UserInterface $account) {
  $config = \Drupal::config('system.date');
  // If the user has a NULL time zone, notify them to set a time zone.   if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) {
    \Drupal::messenger()
      ->addStatus(t('Configure your <a href=":user-edit">account time zone setting</a>.', [
        ':user-edit' => $account->toUrl('edit-form', [
          'query' => \Drupal::destination()
            ->getAsArray(),
          'fragment' => 'edit-timezone',
        ])->toString(),
      ]));
  }
}

/** * The user just logged out. * * @param \Drupal\Core\Session\AccountInterface $account * The user object on which the operation was just performed. */

  public function manageIgnored(array $files, ScaffoldOptions $options) {
    if (!$this->managementOfGitIgnoreEnabled($options)) {
      return;
    }

    // Accumulate entries to add to .gitignore, sorted into buckets based on the     // location of the .gitignore file the entry should be added to.     $add_to_git_ignore = [];
    foreach ($files as $scaffoldResult) {
      $path = $scaffoldResult->destination()->fullPath();
      $is_ignored = Git::checkIgnore($this->io, $path$this->dir);
      if (!$is_ignored) {
        $is_tracked = Git::checkTracked($this->io, $path$this->dir);
        if (!$is_tracked && $scaffoldResult->isManaged()) {
          $dir = realpath(dirname($path));
          $name = basename($path);
          $add_to_git_ignore[$dir][] = '/' . $name;
        }
      }
    }
    // Write out the .gitignore files one at a time.
/** * #lazy_builder callback; renders a form action URL including destination. * * @return array * A renderable array representing the form action. * * @see \Drupal\Core\Form\FormBuilder::renderPlaceholderFormAction() */
  public static function renderPlaceholderFormAction() {
    return [
      '#type' => 'markup',
      '#markup' => UrlHelper::filterBadProtocol(Url::fromRoute('<current>', []['query' => \Drupal::destination()->getAsArray(), 'external' => FALSE])->toString()),
      '#cache' => ['contexts' => ['url.path', 'url.query_args']],
    ];
  }

  /** * {@inheritdoc} */
  public static function trustedCallbacks() {
    return ['renderPlaceholderFormAction'];
  }

}
    $installer_class = $namespace . "\\Install\\Tasks";
    $errors = (new $installer_class())->runTasks();
    if (!empty($errors)) {
      $this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
    }

    if ($modules) {
      $this->container->get('module_handler')->loadAll();
    }

    // Setup the destination to the be frontpage by default.     \Drupal::destination()->set('/');

    // Write the core.extension configuration.     // Required for ConfigInstaller::installDefaultConfig() to work.     $this->container->get('config.storage')->write('core.extension', [
      'module' => array_fill_keys($modules, 0),
      'theme' => [],
      'profile' => '',
    ]);

    $settings = Settings::getAll();
    $settings['php_storage']['default'] = [
      

  public function process(IOInterface $io, ScaffoldOptions $options) {
    return $this->op()->process($this->destination, $io$options);
  }

  /** * Returns TRUE if the target does not exist or has changed. * * @return bool */
  final public function hasChanged() {
    $path = $this->destination()->fullPath();
    if (!file_exists($path)) {
      return TRUE;
    }
    return $this->op()->contents() !== file_get_contents($path);
  }

}

  public static function preRenderCompactLink($element) {
    // By default, link options to pass to l() are normally set in #options.     $element += ['#options' => []];

    if (system_admin_compact_mode()) {
      $element['#title'] = t('Show descriptions');
      $element['#url'] = BaseUrl::fromRoute('system.admin_compact_page', ['mode' => 'off']);
      $element['#options'] = [
        'attributes' => ['title' => t('Expand layout to include descriptions.')],
        'query' => \Drupal::destination()->getAsArray(),
      ];
    }
    else {
      $element['#title'] = t('Hide descriptions');
      $element['#url'] = BaseUrl::fromRoute('system.admin_compact_page', ['mode' => 'on']);
      $element['#options'] = [
        'attributes' => ['title' => t('Compress layout by hiding descriptions.')],
        'query' => \Drupal::destination()->getAsArray(),
      ];
    }

    

  public function processScaffoldFiles(IOInterface $io, ScaffoldOptions $scaffold_options) {
    $results = [];
    foreach ($this as $project_name => $scaffold_files) {
      $io->write("Scaffolding files for <comment>{$project_name}</comment>:");
      foreach ($scaffold_files as $scaffold_file) {
        $results[$scaffold_file->destination()->relativePath()] = $scaffold_file->process($io$scaffold_options);
      }
    }
    return $results;
  }

  /** * Processes the iterator created by ScaffoldFileCollection::create(). * * @param \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection $collection * The iterator to process. * @param \Composer\IO\IOInterface $io * The Composer IO object. * @param \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $scaffold_options * The scaffold options. * * @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult[] * The results array. * * @deprecated. Called when upgrading from the Core Composer Scaffold plugin * version 8.8.x due to a bug in the plugin and handler classes. Do not use * in 8.9.x or 9.x, and remove in Drupal 10.x. */

  protected function createReplaceOp(PackageInterface $package, OperationData $operation_data) {
    if (!$operation_data->hasPath()) {
      throw new \RuntimeException("'path' component required for 'replace' operations.");
    }
    $package_name = $package->getName();
    $package_path = $this->getPackagePath($package);
    $source = ScaffoldFilePath::sourcePath($package_name$package_path$operation_data->destination()$operation_data->path());
    $op = new ReplaceOp($source$operation_data->overwrite());
    return $op;
  }

  /** * Creates an 'append' (or 'prepend') scaffold op. * * @param \Composer\Package\PackageInterface $package * The package that relative paths will be relative from. * @param OperationData $operation_data * The parameter data for this operation object, i.e. the relative 'path'. * * @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface * A scaffold replace operation object. */
return \Drupal::service('renderer')->renderRoot($attached);
  }

  /** * Prints a destination query parameter. * * @return \Symfony\Component\HttpFoundation\Response * A new Response object containing a string with the destination query * parameter. */
  public function destination() {
    $destination = \Drupal::destination()->getAsArray();
    $output = "The destination: " . Html::escape($destination['destination']);
    return new Response($output);
  }

  /** * Returns a response with early rendering in common_test_page_attachments. * * @return \Symfony\Component\HttpFoundation\Response * A new Response object. */
  public function attachments() {
    
return $this->getRedirectDestination()->getAsArray();
  }

  /** * Returns the redirect destination service. * * @return \Drupal\Core\Routing\RedirectDestinationInterface * The redirect destination helper. */
  protected function getRedirectDestination() {
    if (!isset($this->redirectDestination)) {
      $this->redirectDestination = \Drupal::destination();
    }

    return $this->redirectDestination;
  }

  /** * Sets the redirect destination service. * * @param \Drupal\Core\Routing\RedirectDestinationInterface $redirect_destination * The redirect destination service. * * @return $this */
Home | Imprint | This part of the site doesn't use cookies.