MTShop/code/web/themes/contrib/gin/gin.api.php

56 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
/**
* @file
* Hooks for gin theme.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Register routes to apply Gins content edit form layout.
*
* Leverage this hook to achieve a consistent user interface layout on
* administrative edit forms, similar to the node edit forms. Any module
* providing a custom entity type or form mode may wish to implement this
* hook for their form routes. Please note that not every content entity
* form route should enable the Gin edit form layout, for example the
* delete entity form does not need it.
*
* @return array
* An array of route names.
*
* @see GinContentFormHelper->isContentForm()
* @see hook_gin_content_form_routes_alter()
*/
function hook_gin_content_form_routes() {
return [
// Layout a custom node form.
'entity.node.my_custom_form',
// Layout a custom entity type edit form.
'entity.my_type.edit_form',
];
}
/**
* Alter the registered routes to enable or disable Gins edit form layout.
*
* @param array $routes
* The list of routes.
*
* @see GinContentFormHelper->isContentForm()
* @see hook_gin_content_form_routes()
*/
function hook_gin_content_form_routes_alter(array &$routes) {
// Example: disable Gin edit form layout customizations for an entity type.
$routes = array_diff($routes, ['entity.my_type.edit_form']);
}
/**
* @} End of "addtogroup hooks".
*/