public function Submissions::buildSettingsForm in Dashboards with Layout Builder 8
Same name and namespace in other branches
- 2.0.x modules/dashboards_webform/src/Plugin/Dashboard/Submissions.php \Drupal\dashboards_webform\Plugin\Dashboard\Submissions::buildSettingsForm()
Build render array.
Parameters
array $form: Default form.
\Drupal\Core\Form\FormStateInterface $form_state: Default form.
array $configuration: Configuration.
Return value
array Return form array.
Overrides DashboardBase::buildSettingsForm
File
- modules/
dashboards_webform/ src/ Plugin/ Dashboard/ Submissions.php, line 65
Class
- Submissions
- Show account info.
Namespace
Drupal\dashboards_webform\Plugin\DashboardCode
public function buildSettingsForm(array $form, FormStateInterface $form_state, array $configuration) : array {
$webform = FALSE;
if (!empty($configuration['webform'])) {
$webform = $this->entityTypeManager
->getStorage('webform')
->load($configuration['webform']);
}
$form['webform'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'webform',
'#selection_handler' => 'default',
'#default_value' => $webform,
];
$form['period'] = [
'#type' => 'select',
'#options' => [
'hour' => $this
->t('Hour'),
'day' => $this
->t('Day'),
'week' => $this
->t('Week'),
'month' => $this
->t('Month'),
],
'#default_value' => isset($configuration['period']) ? $configuration['period'] : 'day',
];
$form['date'] = [
'#type' => 'select',
'#options' => [
'today' => $this
->t('Today'),
'yesterday' => $this
->t('Yesterday'),
'this_week' => $this
->t('This week'),
'this_month' => $this
->t('This month'),
'last_three_months' => $this
->t('Last 3 months'),
'last_six_months' => $this
->t('Last 6 months'),
'year' => $this
->t('This year'),
],
'#default_value' => isset($configuration['date']) ? $configuration['date'] : 'today',
];
$form['chart_type'] = [
'#type' => 'select',
'#options' => $this
->getAllowedStyles(),
'#default_value' => isset($configuration['chart_type']) ? $configuration['chart_type'] : 'bar',
];
return $form;
}