Commit 910512e8 authored by pradeepvenugopal's avatar pradeepvenugopal Committed by vpradeep
Browse files

Issue #3279408 by venugopp, jfurnas: Possibility to retrieve from self-serving JSON

parent 46bf5200
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ display:
      query:
        type: views_query
        options:
          json_file: /modules/contrib/views_json_source/data/sample/example1.json
          json_file: [site:url]modules/contrib/views_json_source/data/sample/example1.json
          row_apath: data/nodes
          show_errors: 1
      exposed_form:
@@ -195,7 +195,7 @@ display:
      query:
        type: views_query
        options:
          json_file: /modules/contrib/views_json_source/data/sample/example1.json
          json_file: [site:url]modules/contrib/views_json_source/data/sample/example1.json
          row_apath: data/nodes
          headers: ''
          show_errors: 1
+5 −1
Original line number Diff line number Diff line
@@ -193,6 +193,10 @@ class ViewsJsonQuery extends QueryPluginBase {
    try {
      // Replace any dynamic character if any.
      $url = $this->options['json_file'];

      // Replace any Drupal tokens in the url EG: [site:url]
      $url = \Drupal::token()->replace($url);

      while ($param = $this->getUrlParam()) {
        $url = preg_replace('/' . preg_quote('%', '/') . '/', $param, $url, 1);
      }
@@ -479,7 +483,7 @@ class ViewsJsonQuery extends QueryPluginBase {
      '#type' => 'textfield',
      '#title' => $this->t('JSON File'),
      '#default_value' => $this->options['json_file'],
      '#description' => $this->t("The URL or relative path to the JSON file(starting with a slash \"/\")."),
      '#description' => $this->t("The URL or relative path to the JSON file(starting with a slash \"/\").<br />Note: Can use Drupal token as well."),
      '#maxlength' => 1024,
    ];
    $form['row_apath'] = [