X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fdevel%2Fsrc%2FForm%2FConfigsList.php;fp=web%2Fmodules%2Fcontrib%2Fdevel%2Fsrc%2FForm%2FConfigsList.php;h=f0993e77baaadcb9e16927a28e612eedfc9ea018;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/devel/src/Form/ConfigsList.php b/web/modules/contrib/devel/src/Form/ConfigsList.php new file mode 100644 index 000000000..f0993e77b --- /dev/null +++ b/web/modules/contrib/devel/src/Form/ConfigsList.php @@ -0,0 +1,85 @@ + 'details', + '#title' => t('Filter variables'), + '#attributes' => array('class' => array('container-inline')), + '#open' => isset($filter) && trim($filter) != '', + ); + $form['filter']['name'] = array( + '#type' => 'textfield', + '#title' => $this->t('Variable name'), + '#title_display' => 'invisible', + '#default_value' => $filter, + ); + $form['filter']['show'] = array( + '#type' => 'submit', + '#value' => $this->t('Filter'), + ); + + $header = array( + 'name' => array('data' => $this->t('Name')), + 'edit' => array('data' => $this->t('Operations')), + ); + + $rows = array(); + + $destination = $this->getDestinationArray(); + + // List all the variables filtered if any filter was provided. + $names = $this->configFactory()->listAll($filter); + + foreach ($names as $config_name) { + $operations['edit'] = array( + 'title' => $this->t('Edit'), + 'url' => Url::fromRoute('devel.config_edit', array('config_name' => $config_name)), + 'query' => $destination + ); + $rows[] = array( + 'name' => $config_name, + 'operation' => array('data' => array('#type' => 'operations', '#links' => $operations)), + ); + } + + $form['variables'] = array( + '#type' => 'table', + '#header' => $header, + '#rows' => $rows, + '#empty' => $this->t('No variables found') + ); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $filter = $form_state->getValue('name'); + $form_state->setRedirectUrl(Url::FromRoute('devel.configs_list', array('filter' => Html::escape($filter)))); + } + +}