public function ConfigSourcePluginUi::overviewForm in Translation Management Tool 8
Builds the overview form for the source entities.
Parameters
array $form: Drupal form array.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
string $type: Entity type.
Return value
array Drupal form array.
Overrides SourcePluginUiBase::overviewForm
File
- sources/
tmgmt_config/ src/ ConfigSourcePluginUi.php, line 218
Class
- ConfigSourcePluginUi
- Config source plugin UI.
Namespace
Drupal\tmgmt_configCode
public function overviewForm(array $form, FormStateInterface $form_state, $type) {
$form = parent::overviewForm($form, $form_state, $type);
// Load search property params which will be passed into
$search_property_params = array();
$exclude_params = array(
'q',
'page',
);
foreach (\Drupal::request()->query
->all() as $key => $value) {
// Skip exclude params, and those that have empty values, as these would
// make it into query condition instead of being ignored.
if (in_array($key, $exclude_params) || $value === '') {
continue;
}
$search_property_params[$key] = $value;
}
// If the source is of type '_simple_config', we get all definitions that
// don't have an entity type and display them through overviewRowSimple().
if ($type == ConfigSource::SIMPLE_CONFIG) {
$definitions = $this
->getFilteredSimpleConfigDefinitions($search_property_params);
foreach ($definitions as $definition_id => $definition) {
$form['items']['#options'][$definition_id] = $this
->overviewRowSimple($definition);
}
}
else {
foreach ($this
->getTranslatableEntities($type, $search_property_params) as $entity) {
$form['items']['#options'][$entity
->getConfigDependencyName()] = $this
->overviewRow($entity);
}
}
return $form;
}