forked from backdrop-contrib/gin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gin.api.php
80 lines (73 loc) · 2.01 KB
/
gin.api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @file
* Hooks for the Gin theme.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Register paths to apply Gin’s 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 paths. Please note that not every content entity
* form path should enable the Gin edit form layout, for example the
* delete entity form does not need it.
*
* @return array
* An array of paths that are considered to be content forms. Wildcards may
* be used to match multiple paths.
*
* @see gin_content_form_paths()
* @see hook_gin_content_form_paths_alter()
*/
function hook_gin_content_form_paths() {
return array(
'custom_entity/*/edit',
);
}
/**
* Alters the list of paths for content forms.
*
* This function allows modules to alter the list of paths that are considered
* to be content forms in the gin theme. The list of paths is defined by modules
* implementing the hook_gin_content_form_paths() hook.
*
* @param array $paths
* An array of paths that are considered to be content forms. Modify this array
* to alter the list of paths.
*
* @see gin_content_form_paths()
* @see hook_gin_content_form_paths()
*/
function hook_gin_content_form_paths_alter(&$paths) {
// Example: disable Gin edit form customizations for user account paths.
$remove_paths = array(
'user/*/edit',
'admin/people/create',
);
$paths = array_diff($paths, $remove_paths);
}
/**
* Register form ids to opt-out of Gin’s sticky action buttons.
*
* Leverage this hook to opt-out of Gin's sticky action buttons.
* Opting out will keep the action buttons within the form.
*
* @return array
* An array of form ids to ignore.
*
* @see gin_preprocess_form()
*/
function hook_gin_ignore_sticky_form_actions() {
return [
// My custom form.
'my_custom_form',
];
}
/**
* @} End of "addtogroup hooks".
*/