3 namespace Drupal\token;
5 interface TreeBuilderInterface {
8 * The maximum depth for token tree recursion.
13 * Build a tree array of tokens used for themeing or information.
15 * @param string $token_type
17 * @param array $options
18 * (optional) An associative array of additional options, with the following
20 * - 'flat' (defaults to FALSE): Set to true to generate a flat list of
21 * token information. Otherwise, child tokens will be inside the
22 * 'children' parameter of a token.
23 * - 'restricted' (defaults to FALSE): Set to true to how restricted tokens.
24 * - 'depth' (defaults to 4): Maximum number of token levels to recurse.
27 * The token information constructed in a tree or flat list form depending
28 * on $options['flat'].
30 public function buildTree($token_type, array $options = []);
33 * Flatten a token tree.
36 * The tree array as returned by TreeBuilderInterface::buildTree().
39 * The flattened version of the tree.
41 public function flattenTree(array $tree);
44 * Build a render array with token tree built as per specified options.
46 * @param array $token_types
47 * An array containing token types that should be shown in the tree.
48 * @param array $options
49 * (optional) An associative array to control which tokens are shown and
50 * how. The properties available are:
51 * - 'global_types' (defaults to TRUE): Show all global token types along
52 * with the specified types.
53 * - 'click_insert' (defaults to TRUE): Include classes and caption to show
54 * allow inserting tokens in fields by clicking on them.
55 * - 'show_restricted' (defaults to FALSE): Show restricted tokens in the
57 * - 'show_nested' (defaults to FALSE): If this token is nested and should
58 * therefor not show on the token browser as a top level token.
59 * - 'recursion_limit' (defaults to 3): Only show tokens up to the specified
63 * Render array for the token tree.
65 public function buildRenderable(array $token_types, array $options = []);
68 * Build a render array with token tree containing all possible tokens.
70 * @param array $options
71 * (optional) An associative array to control which tokens are shown and
72 * how. The properties available are: See
73 * \Drupal\token\TreeBuilderInterface::buildRenderable() for details.
76 * Render array for the token tree.
78 public function buildAllRenderable(array $options = []);