setConnectionSettingsDefaults example


  protected function addConnectionSettings($backend) {
    $defaults = [];
    $form = [];

    // Create an instance of the file transfer class to get its settings form.     $filetransfer = $this->getFiletransfer($backend);
    if ($filetransfer) {
      $form = $filetransfer->getSettingsForm();
    }
    // Fill in the defaults based on the saved settings, if any.     $this->setConnectionSettingsDefaults($form, NULL, $defaults);
    return $form;
  }

  /** * Sets the default settings on a file transfer connection form recursively. * * The default settings for the file transfer connection forms are saved in * the database. The settings are stored as a nested array in the case of a * settings form that has details or otherwise uses a nested structure. * Therefore, to properly add defaults, we need to walk through all the * children form elements and process those defaults recursively. * * @param $element * Reference to the Form API form element we're operating on. * @param $key * The key for our current form element, if any. * @param array $defaults * The default settings for the file transfer backend we're operating on. */
Home | Imprint | This part of the site doesn't use cookies.