Loading src/Form/OptionsForm.php +2 −5 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\Component\Serialization\Json; /** * Options form. Loading Loading @@ -51,10 +52,6 @@ class OptionsForm extends FormBase { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL): array { $form['#attached']['library'][] = 'easychart/easychart.admin'; $form['#attached']['library'][] = 'easychart/lib.easycharts.full'; $form['#attached']['library'][] = 'easychart/lib.highcharts'; $default_options = ''; if (file_exists('public://easychart-options.json')) { $default_options = file_get_contents('public://easychart-options.json'); Loading Loading @@ -119,7 +116,7 @@ class OptionsForm extends FormBase { } // Write to file. $this->fileSystem->saveData(json_encode($current_options), 'public://easychart-options.json', FileSystemInterface::EXISTS_REPLACE); $this->fileSystem->saveData(json_encode($current_options, JSON_PRETTY_PRINT), 'public://easychart-options.json', FileSystemInterface::EXISTS_REPLACE); $this->messenger()->addMessage($this->t('The configuration options have been saved.')); } else { Loading Loading
src/Form/OptionsForm.php +2 −5 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\Component\Serialization\Json; /** * Options form. Loading Loading @@ -51,10 +52,6 @@ class OptionsForm extends FormBase { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL): array { $form['#attached']['library'][] = 'easychart/easychart.admin'; $form['#attached']['library'][] = 'easychart/lib.easycharts.full'; $form['#attached']['library'][] = 'easychart/lib.highcharts'; $default_options = ''; if (file_exists('public://easychart-options.json')) { $default_options = file_get_contents('public://easychart-options.json'); Loading Loading @@ -119,7 +116,7 @@ class OptionsForm extends FormBase { } // Write to file. $this->fileSystem->saveData(json_encode($current_options), 'public://easychart-options.json', FileSystemInterface::EXISTS_REPLACE); $this->fileSystem->saveData(json_encode($current_options, JSON_PRETTY_PRINT), 'public://easychart-options.json', FileSystemInterface::EXISTS_REPLACE); $this->messenger()->addMessage($this->t('The configuration options have been saved.')); } else { Loading