Loading config/install/live_data_gsheet.settings.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line gsheet_url: 'aMdVDll87z1icRWV9rvLV3ctiAuNmL8h1PJiqT2olSWb_59EyxEI9Bn7yN_RwbeOggSmavN4HDTqWHl8gvLSWPMuVLqFZ1t0m5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnLS5EWOOg7NOQ7IOCssN5bFXRYudorq1d_L2IPc2PXn4XBAjl5BBb107Nudlv30sCjhWR2W3fPutvm2BR9Ze4Pahjrv7T-yLjdz9Jw9Md8uu&lib=MyxIGOn_XvAUfVfmQ7xSzIH1yafxfZTL8' config/schema/live_data_gsheet.schema.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line live_data_gsheet.settings: type: config_object label: 'Default Setting' mapping: gsheet_url: type: label label: 'Gsheet Url' live_data_gsheet.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ live_data_gsheet.content: no_cache: 'TRUE' live_data_gsheet.gsheet_url: path: /admin/config/gsheet-url path: '/admin/config/gsheet-url' defaults: _title: 'Setting for google Sheet' _form: \Drupal\live_data_gsheet\Form\GsheetSettingsForm Loading src/Controller/LiveDataController.php +4 −6 Original line number Diff line number Diff line Loading @@ -11,21 +11,19 @@ use Drupal\Core\Controller\ControllerBase; class LiveDataController extends ControllerBase { public function content() { $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=zZtxYtNfrZGmiEyntrL_gOeIufpKYxcthMa58Cfq6z8DqDlpDKRPAVVAeD4C3XamDVRpHM6cKvTukRvyodrJMaY-W7xHL21fm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnKn5UvN46uZqEsijPcj7I3FQl2thzfl064SOls5TBfuCzJgq3VMUL8FAuKi1ca69Caw4evFDf__mVqgI7HaiHbo2fWXRQ2N0Htz9Jw9Md8uu&lib=MyxIGOn_XvAUfVfmQ7xSzIH1yafxfZTL8"); // $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=gVYPI9wxnPyxcmCwo7WX9F5DerbWoaHD1o8VdxibdBmYwbcnxqFVc1ulMMlOyGhVZeag-aZY1pJe0GGxLn5MRA5C71FQ1zsCm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnIU2Uxo_yCqdS0DUWCeCjbikRHB97lS0_TFjmaOfDkXKHDD1ZV1Cr7pQWdN_ruGbFRRTBfmRk5vNctyCcolCEthlqIOy3Oh6udz9Jw9Md8uu&lib=MCRqhAFvwRcAeqtjc3d_kxF3HB3z6pFss"); $deployment_id = \Drupal::config('gsheet.settings')->get('gsheet_url'); $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=".$deployment_id); $response = json_decode( $response, true ); // dd($response); // $final_response = $response["data"]; $result = $response; $data['header'] = $result[0]; array_shift($result); $data['rows'] = $result; // dd($data); return array( '#theme' => 'gsheet', '#data' => $data, '#attached' => [ 'library' => ['live_data_gsheet/data-tables-library'] 'library' => ['live_data_gsheet/live_data_gsheet.data-table'] ] ); } Loading src/Form/GsheetSettingsForm.php +5 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ class GsheetSettingsForm extends ConfigFormBase { * {@inheritdoc} */ protected function getEditableConfigNames() { return ['gsheet.settings']; return ['live_data_gsheet.settings']; } /** Loading @@ -29,9 +29,9 @@ class GsheetSettingsForm extends ConfigFormBase { */ public function buildForm(array $form, FormStateInterface $form_state) { $form['gsheet_url'] = [ '#type' => 'textfield', '#title' => $this->t('Google Sheet URL'), '#default_value' => $this->config('gsheet.settings')->get('gsheet_url'), '#type' => 'textarea', '#title' => $this->t('Deployment Id'), '#default_value' => $this->config('live_data_gsheet.settings')->get('gsheet_url'), ]; return parent::buildForm($form, $form_state); Loading @@ -41,7 +41,7 @@ class GsheetSettingsForm extends ConfigFormBase { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->config('gsheet.settings') $this->config('live_data_gsheet.settings') ->set('gsheet_url', $form_state->getValue('gsheet_url')) ->save(); Loading Loading
config/install/live_data_gsheet.settings.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line gsheet_url: 'aMdVDll87z1icRWV9rvLV3ctiAuNmL8h1PJiqT2olSWb_59EyxEI9Bn7yN_RwbeOggSmavN4HDTqWHl8gvLSWPMuVLqFZ1t0m5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnLS5EWOOg7NOQ7IOCssN5bFXRYudorq1d_L2IPc2PXn4XBAjl5BBb107Nudlv30sCjhWR2W3fPutvm2BR9Ze4Pahjrv7T-yLjdz9Jw9Md8uu&lib=MyxIGOn_XvAUfVfmQ7xSzIH1yafxfZTL8'
config/schema/live_data_gsheet.schema.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line live_data_gsheet.settings: type: config_object label: 'Default Setting' mapping: gsheet_url: type: label label: 'Gsheet Url'
live_data_gsheet.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ live_data_gsheet.content: no_cache: 'TRUE' live_data_gsheet.gsheet_url: path: /admin/config/gsheet-url path: '/admin/config/gsheet-url' defaults: _title: 'Setting for google Sheet' _form: \Drupal\live_data_gsheet\Form\GsheetSettingsForm Loading
src/Controller/LiveDataController.php +4 −6 Original line number Diff line number Diff line Loading @@ -11,21 +11,19 @@ use Drupal\Core\Controller\ControllerBase; class LiveDataController extends ControllerBase { public function content() { $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=zZtxYtNfrZGmiEyntrL_gOeIufpKYxcthMa58Cfq6z8DqDlpDKRPAVVAeD4C3XamDVRpHM6cKvTukRvyodrJMaY-W7xHL21fm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnKn5UvN46uZqEsijPcj7I3FQl2thzfl064SOls5TBfuCzJgq3VMUL8FAuKi1ca69Caw4evFDf__mVqgI7HaiHbo2fWXRQ2N0Htz9Jw9Md8uu&lib=MyxIGOn_XvAUfVfmQ7xSzIH1yafxfZTL8"); // $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=gVYPI9wxnPyxcmCwo7WX9F5DerbWoaHD1o8VdxibdBmYwbcnxqFVc1ulMMlOyGhVZeag-aZY1pJe0GGxLn5MRA5C71FQ1zsCm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnIU2Uxo_yCqdS0DUWCeCjbikRHB97lS0_TFjmaOfDkXKHDD1ZV1Cr7pQWdN_ruGbFRRTBfmRk5vNctyCcolCEthlqIOy3Oh6udz9Jw9Md8uu&lib=MCRqhAFvwRcAeqtjc3d_kxF3HB3z6pFss"); $deployment_id = \Drupal::config('gsheet.settings')->get('gsheet_url'); $response = file_get_contents("https://script.googleusercontent.com/macros/echo?user_content_key=".$deployment_id); $response = json_decode( $response, true ); // dd($response); // $final_response = $response["data"]; $result = $response; $data['header'] = $result[0]; array_shift($result); $data['rows'] = $result; // dd($data); return array( '#theme' => 'gsheet', '#data' => $data, '#attached' => [ 'library' => ['live_data_gsheet/data-tables-library'] 'library' => ['live_data_gsheet/live_data_gsheet.data-table'] ] ); } Loading
src/Form/GsheetSettingsForm.php +5 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ class GsheetSettingsForm extends ConfigFormBase { * {@inheritdoc} */ protected function getEditableConfigNames() { return ['gsheet.settings']; return ['live_data_gsheet.settings']; } /** Loading @@ -29,9 +29,9 @@ class GsheetSettingsForm extends ConfigFormBase { */ public function buildForm(array $form, FormStateInterface $form_state) { $form['gsheet_url'] = [ '#type' => 'textfield', '#title' => $this->t('Google Sheet URL'), '#default_value' => $this->config('gsheet.settings')->get('gsheet_url'), '#type' => 'textarea', '#title' => $this->t('Deployment Id'), '#default_value' => $this->config('live_data_gsheet.settings')->get('gsheet_url'), ]; return parent::buildForm($form, $form_state); Loading @@ -41,7 +41,7 @@ class GsheetSettingsForm extends ConfigFormBase { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->config('gsheet.settings') $this->config('live_data_gsheet.settings') ->set('gsheet_url', $form_state->getValue('gsheet_url')) ->save(); Loading