You are here

public function WSConnectorSimpleHTTPWithLangReplacement::getOptionsForm in Web Service Data 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/WSConnector/WSConnectorSimpleHTTPWithLangReplacement.php \Drupal\wsdata\Plugin\WSConnector\WSConnectorSimpleHTTPWithLangReplacement::getOptionsForm()

Return the settings form provided by the connector.

Overrides WSConnectorSimpleHTTP::getOptionsForm

File

src/Plugin/WSConnector/WSConnectorSimpleHTTPWithLangReplacement.php, line 65

Class

WSConnectorSimpleHTTPWithLangReplacement
HTTP Connector.

Namespace

Drupal\wsdata\Plugin\WSConnector

Code

public function getOptionsForm($options = []) {
  $form = parent::getOptionsForm($options);
  $form['intructions'] = [
    '#markup' => $this
      ->t("This connector will replace the string [LANGUAGE] in the path or the WSServer URL with the strings defined below, depending on the site's current content language"),
    '#weight' => -50,
  ];
  $form['urllang'] = [
    '#title' => $this
      ->t('URL Language Replacement'),
    '#type' => 'fieldset',
  ];
  foreach ($this->language_manager
    ->getLanguages() as $langcode => $language) {
    $form['lang-' . $langcode] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Replacement value for %lang', [
        '%lang' => $language
          ->getName(),
      ]),
      '#default_value' => $langcode,
    ];
  }
  return $form;
}