Loading live_data_gsheet.routing.yml 0 → 100644 +9 −0 Original line number Diff line number Diff line live_data_gsheet.content: path: '/live-gsheet-data' defaults: _controller: '\Drupal\live_data_gsheet\Controller\LiveDataController::content' _title: 'Google-Sheet data' requirements: _permission: 'access content' options: no_cache: 'TRUE' src/Controller/LiveDataController.php 0 → 100644 +33 −0 Original line number Diff line number Diff line <?php /** * @file * Contains \Drupal\live_data_gsheet\Controller\jsonController. */ namespace Drupal\live_data_gsheet\Controller; use Drupal\Core\Controller\ControllerBase; class LiveDataController extends ControllerBase { public function content() { $search_text = t(isset( $_GET["search_text"] ) ? $_GET["search_text"] : ''); $search_text = $search_text->__toString(); // $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=gVYPI9wxnPyxcmCwo7WX9F5DerbWoaHD1o8VdxibdBmYwbcnxqFVc1ulMMlOyGhVZeag-aZY1pJe0GGxLn5MRA5C71FQ1zsCm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnIU2Uxo_yCqdS0DUWCeCjbikRHB97lS0_TFjmaOfDkXKHDD1ZV1Cr7pQWdN_ruGbFRRTBfmRk5vNctyCcolCEthlqIOy3Oh6udz9Jw9Md8uu&lib=MCRqhAFvwRcAeqtjc3d_kxF3HB3z6pFss"); $response = ""; $response = json_decode( $response, true ); $final_response = $response["data"]; $data["data"] = $final_response; $data["search_term"] = $search_text; return array( '#theme' => 'live_data_gsheet', '#data' => $data, '#attached' => [ 'library' => ['live_data_gsheet/data-tables-library'] ] ); } } Loading
live_data_gsheet.routing.yml 0 → 100644 +9 −0 Original line number Diff line number Diff line live_data_gsheet.content: path: '/live-gsheet-data' defaults: _controller: '\Drupal\live_data_gsheet\Controller\LiveDataController::content' _title: 'Google-Sheet data' requirements: _permission: 'access content' options: no_cache: 'TRUE'
src/Controller/LiveDataController.php 0 → 100644 +33 −0 Original line number Diff line number Diff line <?php /** * @file * Contains \Drupal\live_data_gsheet\Controller\jsonController. */ namespace Drupal\live_data_gsheet\Controller; use Drupal\Core\Controller\ControllerBase; class LiveDataController extends ControllerBase { public function content() { $search_text = t(isset( $_GET["search_text"] ) ? $_GET["search_text"] : ''); $search_text = $search_text->__toString(); // $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=gVYPI9wxnPyxcmCwo7WX9F5DerbWoaHD1o8VdxibdBmYwbcnxqFVc1ulMMlOyGhVZeag-aZY1pJe0GGxLn5MRA5C71FQ1zsCm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnIU2Uxo_yCqdS0DUWCeCjbikRHB97lS0_TFjmaOfDkXKHDD1ZV1Cr7pQWdN_ruGbFRRTBfmRk5vNctyCcolCEthlqIOy3Oh6udz9Jw9Md8uu&lib=MCRqhAFvwRcAeqtjc3d_kxF3HB3z6pFss"); $response = ""; $response = json_decode( $response, true ); $final_response = $response["data"]; $data["data"] = $final_response; $data["search_term"] = $search_text; return array( '#theme' => 'live_data_gsheet', '#data' => $data, '#attached' => [ 'library' => ['live_data_gsheet/data-tables-library'] ] ); } }