Skip to content
Snippets Groups Projects

Resolve #3511225 "Fix phpcs issues"

Merged Charllie Quadros requested to merge issue/jstimer-3511225:3511225-fix-phpcs-issues into 2.0.x
5 files
+ 179
134
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -8,45 +8,62 @@
use Drupal\Core\Form\FormStateInterface;
/**
* Implementation of hook_form_alter().
* Implements hook_form_alter().
*
* Add the clock widget specific settings to admin screen.
*/
function jst_clock_form_jstimer_admin_settings_alter(&$form, FormStateInterface $form_state, $form_id) {
$config = \Drupal::config('jstimer.settings');
$config = \Drupal::config('jstimer.settings');
$form['jst_clock'] = array(
'#type' => 'fieldset',
'#title' => t('Clock widget'),
'#weight' => 5,
);
$form['jst_clock'] = [
'#type' => 'fieldset',
'#title' => t('Clock widget'),
'#weight' => 5,
];
$form['jst_clock']['jstimer_jst_clock_demo'] = array(
'#theme' => 'jst_clock',
);
$form['jst_clock']['jstimer_jst_clock_demo'] = [
'#theme' => 'jst_clock',
];
$form['jst_clock']['jstimer_jst_clock_type'] = array(
'#type' => 'radios',
'#title' => t('Clock type'),
'#default_value' => $config->get('jstimer_jst_clock_type'),
'#options' => array(0 => t('12-hour plain text'), 1 => t('24-hour plain text'), 2 => t('Analog canvas'), 3 => t('Analog SVG')),
'#description' => t("The analog clocks are experimental and only works on Firefox, Opera, and Safari and IE9.")
);
$form['jst_clock']['jstimer_jst_clock_type'] = [
'#type' => 'radios',
'#title' => t('Clock type'),
'#default_value' => $config->get('jstimer_jst_clock_type'),
'#options' => [
0 => t('12-hour plain text'),
1 => t('24-hour plain text'),
2 => t('Analog canvas'),
3 => t('Analog SVG'),
],
'#description' => t("The analog clocks are experimental and only works on Firefox, Opera, and Safari and IE9."),
];
$form['jst_clock']['jst_clock_sva_file'] = array(
'#type' => 'textfield',
'#title' => t('Clock svg file'),
'#default_value' => $config->get('jst_clock_sva_file'),
'#description' => t('The name of the svg file to use for the SVG clock. They are stored in the clocks sub directory.'),
);
$form['jst_clock']['jst_clock_sva_file'] = [
'#type' => 'textfield',
'#title' => t('Clock svg file'),
'#default_value' => $config->get('jst_clock_sva_file'),
'#description' => t('The name of the svg file to use for the SVG clock. They are stored in the clocks sub directory.'),
];
$form['buttons']['#weight'] = 10;
$form['buttons']['#weight'] = 10;
// Put this module's submit handler first so it can save before javascript file is built.
// Put this module's submit handler first so it can save
// before the JavaScript file is built.
array_unshift($form['#submit'], 'jst_clock_admin_settings_submit');
}
/**
* Form submission handler for the JST Clock admin settings form.
*
* Saves the selected clock type and SVG file configuration.
*
* @param array $form
* The form structure.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
function jst_clock_admin_settings_submit($form, FormStateInterface $form_state) {
$config = \Drupal::configFactory()->getEditable('jstimer.settings');
Loading