public function ContentStateStatistic::getConfigSpecificFormFields in Content Planner 8
Add additonal form elements specific to the Plugin.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
\Symfony\Component\HttpFoundation\Request $request: The request.
array $block_configuration: The block configuration.
Return value
mixed Gets the config form fields.
Overrides DashboardBlockBase::getConfigSpecificFormFields
File
- modules/
content_kanban/ src/ Plugin/ DashboardBlock/ ContentStateStatistic.php, line 64
Class
- ContentStateStatistic
- Provides a Dashboard block for Content Planner Dashboard.
Namespace
Drupal\content_kanban\Plugin\DashboardBlockCode
public function getConfigSpecificFormFields(FormStateInterface &$form_state, Request &$request, array $block_configuration) {
$form = [];
$workflow_options = [];
// Get all workflows.
$workflows = Workflow::loadMultiple();
/* @var $workflow \Drupal\workflows\Entity\Workflow */
foreach ($workflows as $workflow) {
if ($workflow
->status()) {
$workflow_options[$workflow
->id()] = $workflow
->label();
}
}
$form['workflow_id'] = [
'#type' => 'select',
'#title' => t('Select workflow'),
'#required' => TRUE,
'#options' => $workflow_options,
'#default_value' => $this
->getCustomConfigByKey($block_configuration, 'workflow_id', ''),
];
return $form;
}