class ContainerController in GoogleTagManager 8
Controller for the container configuration entity type.
Hierarchy
- class \Drupal\Core\Entity\Controller\EntityController implements ContainerInjectionInterface uses UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\google_tag\ContainerController
Expanded class hierarchy of ContainerController
File
- src/
ContainerController.php, line 15
Namespace
Drupal\google_tagView source
class ContainerController extends EntityController {
/**
* Route title callback.
*
* @param string $entity_type_id
* The entity type ID.
*
* @return string
* The title for the add entity page.
*/
public function addTitle($entity_type_id) {
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
return $this
->t('Add @entity-type', [
'@entity-type' => $entity_type
->getSingularLabel(),
]);
}
/**
* Route title callback.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param \Drupal\Core\Entity\EntityInterface $_entity
* (optional) An entity, passed in directly from the request attributes.
*
* @return string|null
* The title for the entity edit page, if an entity was found.
*/
public function editTitle(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
if ($entity = $this
->doGetEntity($route_match, $_entity)) {
return $this
->t('Edit %label container', [
'%label' => $entity
->label(),
]);
}
}
/**
* Enables a Container object.
*
* @param \Drupal\google_tag\Entity\Container $google_tag_container
* The Container object to enable.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* A redirect response to the google_tag_container listing page.
*
* @todo The parameter name must match that used in routing.yml although the
* documentation suggests otherwise.
*/
public function enable(Container $google_tag_container) {
$google_tag_container
->enable()
->save();
return new RedirectResponse($google_tag_container
->toUrl('collection', [
'absolute' => TRUE,
])
->toString());
}
/**
* Disables a Container object.
*
* @param \Drupal\google_tag\Entity\Container $google_tag_container
* The Container object to disable.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* A redirect response to the google_tag_container listing page.
*/
public function disable(Container $google_tag_container) {
$google_tag_container
->disable()
->save();
return new RedirectResponse($google_tag_container
->toUrl('collection', [
'absolute' => TRUE,
])
->toString());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContainerController:: |
public | function |
Route title callback. Overrides EntityController:: |
|
ContainerController:: |
public | function | Disables a Container object. | |
ContainerController:: |
public | function |
Route title callback. Overrides EntityController:: |
|
ContainerController:: |
public | function | Enables a Container object. | |
EntityController:: |
protected | property | The entity repository. | |
EntityController:: |
protected | property | The entity type bundle info. | |
EntityController:: |
protected | property | The entity manager. | |
EntityController:: |
protected | property | The renderer. | |
EntityController:: |
public | function | Provides a generic add title callback for entities with bundles. | |
EntityController:: |
public | function | Displays add links for the available bundles. | |
EntityController:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
EntityController:: |
public | function | Provides a generic delete title callback. | |
EntityController:: |
protected | function | Determines the entity. | |
EntityController:: |
protected | function | Expands the bundle information with descriptions, if known. | |
EntityController:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
EntityController:: |
public | function | Provides a generic title callback for a single entity. | |
EntityController:: |
public | function | Constructs a new EntityController. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |