public function YandexMetricsReportsCronForm::buildForm in Yandex.Metrics 8.2
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- yandex_metrics_reports/
src/ Form/ YandexMetricsReportsCronForm.php, line 33 - Contains \Drupal\yandex_metrics_reports\Form\YandexMetricsReportsCronForm.
Class
- YandexMetricsReportsCronForm
- Provides a cron settings form.
Namespace
Drupal\yandex_metrics_reports\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Create config object.
$config = $this->configFactory
->get('yandex_metrics_reports.settings');
$form['popular_content'] = array(
'#type' => 'fieldset',
'#title' => t('Popular Content Block Data'),
);
$options = array(
'day' => t('Today'),
'yesterday' => t('Yesterday'),
'week' => t('Week'),
'month' => t('Month'),
);
$form['popular_content']['date_period'] = array(
'#type' => 'select',
'#title' => t('Date period'),
'#description' => t('This date period is used to fetch popular content from Yandex.Metrica by cron.'),
'#options' => $options,
'#default_value' => $config
->get('popular_content_date_period'),
);
return parent::buildForm($form, $form_state);
}