Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\name\Service;
6
7/**
8 * Defines a name formatter for component arrays and lists.
9 */
10interface NameFormatterInterface {
11
12  /**
13   * Formats an array of name components.
14   *
15   * @param array<string, mixed> $components
16   *   Name components (title, given, middle, family, etc.).
17   * @param string $type
18   *   Name format entity id; falls back to default.
19   * @param string|null $langcode
20   *   Language code or NULL for UI language.
21   *
22   * @return \Drupal\Component\Render\MarkupInterface
23   *   A renderable object representing the name.
24   */
25  public function format(array $components, $type = 'default', $langcode = NULL);
26
27  /**
28   * Formats a list of author information.
29   *
30   * @param array<int, array<string, mixed>> $items
31   *   Nested name component arrays.
32   * @param string $type
33   *   Name format entity id.
34   * @param string $list_type
35   *   Name list format entity id.
36   * @param string|null $langcode
37   *   Language code or NULL for UI language.
38   *
39   * @return \Drupal\Component\Render\MarkupInterface
40   *   The processed name in a MarkupInterface object.
41   */
42  public function formatList(array $items, $type = 'default', $list_type = 'default', $langcode = NULL);
43
44  /**
45   * Sets the value of a setting for the formatter.
46   *
47   * @param string $key
48   *   The setting name.
49   * @param mixed $value
50   *   The setting value.
51   *
52   * @return static
53   *   The formatter instance.
54   */
55  public function setSetting($key, $value);
56
57  /**
58   * Gets the value of a setting for the formatter.
59   *
60   * @param string $key
61   *   The setting name.
62   *
63   * @return mixed
64   *   The value of the setting or NULL if not found.
65   */
66  public function getSetting($key);
67
68  /**
69   * Defines the supported final delimiter options.
70   *
71   * @param bool $include_examples
72   *   TRUE to include examples in the options.
73   *
74   * @return array<string, \Drupal\Core\StringTranslation\TranslatableMarkup|string>
75   *   Keyed options that are supported.
76   */
77  public function getLastDelimiterTypes($include_examples = TRUE);
78
79  /**
80   * Deprecated: use getLastDelimiterTypes() instead.
81   *
82   * @param bool $include_examples
83   *   TRUE to include examples in the options.
84   *
85   * @return array<string, \Drupal\Core\StringTranslation\TranslatableMarkup|string>
86   *   Keyed options that are supported.
87   *
88   *   cspell:ignore delimitor
89   *
90   * @deprecated in name:8.x-1.1 and is removed from name:2.0.0. Use
91   *   getLastDelimiterTypes() instead.
92   *
93   * @see https://www.drupal.org/project/name/issues/3518599
94   */
95  public function getLastDelimitorTypes($include_examples = TRUE);
96
97  /**
98   * Defines the supported final delimiter behavior options.
99   *
100   * @param bool $include_examples
101   *   TRUE to include examples in the options.
102   *
103   * @return array<string, \Drupal\Core\StringTranslation\TranslatableMarkup|string>
104   *   Keyed options that are supported.
105   */
106  public function getLastDelimiterBehaviors($include_examples = TRUE);
107
108  /**
109   * Deprecated: use getLastDelimiterBehaviors() instead.
110   *
111   * @param bool $include_examples
112   *   TRUE to include examples in the options.
113   *
114   * @return array<string, \Drupal\Core\StringTranslation\TranslatableMarkup|string>
115   *   Keyed options that are supported.
116   *
117   *   cspell:ignore delimitor
118   *
119   * @deprecated in name:8.x-1.1 and is removed from name:2.0.0. Use
120   *   getLastDelimiterBehaviors() instead.
121   *
122   * @see https://www.drupal.org/project/name/issues/3518599
123   */
124  public function getLastDelimitorBehaviors($include_examples = TRUE);
125
126}