3 namespace Drupal\config_test;
5 use Drupal\Core\Controller\ControllerBase;
6 use Drupal\config_test\Entity\ConfigTest;
7 use Symfony\Component\HttpFoundation\RedirectResponse;
10 * Route controller class for the config_test module.
12 class ConfigTestController extends ControllerBase {
15 * Route title callback.
17 * @param \Drupal\config_test\Entity\ConfigTest $config_test
18 * The ConfigTest object.
21 * The title for the ConfigTest edit form.
23 public function editTitle(ConfigTest $config_test) {
24 return $this->t('Edit %label', ['%label' => $config_test->label()]);
28 * Enables a ConfigTest object.
30 * @param \Drupal\config_test\ConfigTest $config_test
31 * The ConfigTest object to enable.
33 * @return \Symfony\Component\HttpFoundation\RedirectResponse
34 * A redirect response to the config_test listing page.
36 public function enable(ConfigTest $config_test) {
37 $config_test->enable()->save();
38 return new RedirectResponse($config_test->url('collection', ['absolute' => TRUE]));
42 * Disables a ConfigTest object.
44 * @param \Drupal\config_test\ConfigTest $config_test
45 * The ConfigTest object to disable.
47 * @return \Symfony\Component\HttpFoundation\RedirectResponse
48 * A redirect response to the config_test listing page.
50 public function disable(ConfigTest $config_test) {
51 $config_test->disable()->save();
52 return new RedirectResponse($config_test->url('collection', ['absolute' => TRUE]));