class AlinksController in Alinks 8
Returns responses for alinks configuration routes.
Hierarchy
- class \Drupal\alinks\Controller\AlinksController implements ContainerInjectionInterface
Expanded class hierarchy of AlinksController
File
- src/
Controller/ AlinksController.php, line 14
Namespace
Drupal\alinks\ControllerView source
class AlinksController implements ContainerInjectionInterface {
/**
* The configuration factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new controller.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The configuration factory.
*/
public function __construct(ConfigFactoryInterface $configFactory) {
$this->configFactory = $configFactory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory'));
}
/**
* Remove the given entity type, bundle and display from alinks configuration.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* Return a redirect to the alinks settings page.
*/
public function delete($entity_type, $entity_bundle, $entity_display) {
$config = $this->configFactory
->getEditable('alinks.settings');
$displays = array_values(array_filter($config
->get('displays'), function ($display) use ($entity_type, $entity_bundle, $entity_display) {
return !($display['entity_type'] == $entity_type && $display['entity_bundle'] == $entity_bundle && $display['entity_display'] == $entity_display);
}));
$config
->set('displays', $displays)
->save();
return new RedirectResponse(Url::fromRoute('alink_keyword.settings')
->setAbsolute()
->toString());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AlinksController:: |
protected | property | The configuration factory. | |
AlinksController:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
AlinksController:: |
public | function | Remove the given entity type, bundle and display from alinks configuration. | |
AlinksController:: |
public | function | Constructs a new controller. |