class ConfigTestController
Same name and namespace in other branches
- 11.x core/modules/config/tests/config_test/src/ConfigTestController.php \Drupal\config_test\ConfigTestController
Route controller class for the config_test module.
Hierarchy
- class \Drupal\Core\Controller\ControllerBase extends \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\config_test\ConfigTestController implements \Drupal\Core\Controller\ControllerBase
Expanded class hierarchy of ConfigTestController
File
-
core/
modules/ config/ tests/ config_test/ src/ ConfigTestController.php, line 12
Namespace
Drupal\config_testView source
class ConfigTestController extends ControllerBase {
/**
* Route title callback.
*
* @param \Drupal\config_test\Entity\ConfigTest $config_test
* The ConfigTest object.
*
* @return string
* The title for the ConfigTest edit form.
*/
public function editTitle(ConfigTest $config_test) {
return $this->t('Edit %label', [
'%label' => $config_test->label(),
]);
}
/**
* Enables a ConfigTest object.
*
* @param \Drupal\config_test\ConfigTest $config_test
* The ConfigTest object to enable.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* A redirect response to the config_test listing page.
*/
public function enable(ConfigTest $config_test) {
$config_test->enable()
->save();
return new RedirectResponse($config_test->toUrl('collection', [
'absolute' => TRUE,
])
->toString());
}
/**
* Disables a ConfigTest object.
*
* @param \Drupal\config_test\ConfigTest $config_test
* The ConfigTest object to disable.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* A redirect response to the config_test listing page.
*/
public function disable(ConfigTest $config_test) {
$config_test->disable()
->save();
return new RedirectResponse($config_test->toUrl('collection', [
'absolute' => TRUE,
])
->toString());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.