comparison core/modules/options/options.module @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
3 /** 3 /**
4 * @file 4 * @file
5 * Defines selection, check box and radio button widgets for text and numeric fields. 5 * Defines selection, check box and radio button widgets for text and numeric fields.
6 */ 6 */
7 7
8 use Drupal\Core\Url;
8 use Drupal\Core\Entity\FieldableEntityInterface; 9 use Drupal\Core\Entity\FieldableEntityInterface;
9 use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException; 10 use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
10 use Drupal\Core\Field\FieldStorageDefinitionInterface; 11 use Drupal\Core\Field\FieldStorageDefinitionInterface;
11 use Drupal\Core\Routing\RouteMatchInterface; 12 use Drupal\Core\Routing\RouteMatchInterface;
12 use Drupal\field\FieldStorageConfigInterface; 13 use Drupal\field\FieldStorageConfigInterface;
17 function options_help($route_name, RouteMatchInterface $route_match) { 18 function options_help($route_name, RouteMatchInterface $route_match) {
18 switch ($route_name) { 19 switch ($route_name) {
19 case 'help.page.options': 20 case 'help.page.options':
20 $output = ''; 21 $output = '';
21 $output .= '<h3>' . t('About') . '</h3>'; 22 $output .= '<h3>' . t('About') . '</h3>';
22 $output .= '<p>' . t('The Options module allows you to create fields where data values are selected from a fixed list of options. Usually these items are entered through a select list, checkboxes, or radio buttons. See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a> pages for general information on fields and how to create and manage them. For more information, see the <a href=":options_do">online documentation for the Options module</a>.', [':field' => \Drupal::url('help.page', ['name' => 'field']), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', ['name' => 'field_ui']) : '#', ':options_do' => 'https://www.drupal.org/documentation/modules/options']) . '</p>'; 23 $output .= '<p>' . t('The Options module allows you to create fields where data values are selected from a fixed list of options. Usually these items are entered through a select list, checkboxes, or radio buttons. See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a> pages for general information on fields and how to create and manage them. For more information, see the <a href=":options_do">online documentation for the Options module</a>.', [':field' => Url::fromRoute('help.page', ['name' => 'field'])->toString(), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? Url::fromRoute('help.page', ['name' => 'field_ui'])->toString() : '#', ':options_do' => 'https://www.drupal.org/documentation/modules/options']) . '</p>';
23 $output .= '<h3>' . t('Uses') . '</h3>'; 24 $output .= '<h3>' . t('Uses') . '</h3>';
24 $output .= '<dl>'; 25 $output .= '<dl>';
25 $output .= '<dt>' . t('Managing and displaying list fields') . '</dt>'; 26 $output .= '<dt>' . t('Managing and displaying list fields') . '</dt>';
26 $output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the list fields can be configured separately. See the <a href=":field_ui">Field UI help</a> for more information on how to manage fields and their display.', [':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', ['name' => 'field_ui']) : '#']) . '</dd>'; 27 $output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the list fields can be configured separately. See the <a href=":field_ui">Field UI help</a> for more information on how to manage fields and their display.', [':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? Url::fromRoute('help.page', ['name' => 'field_ui'])->toString() : '#']) . '</dd>';
27 $output .= '<dt>' . t('Defining option keys and labels') . '</dt>'; 28 $output .= '<dt>' . t('Defining option keys and labels') . '</dt>';
28 $output .= '<dd>' . t('When you define the list options you can define a key and a label for each option in the list. The label will be shown to the users while the key gets stored in the database.') . '</dd>'; 29 $output .= '<dd>' . t('When you define the list options you can define a key and a label for each option in the list. The label will be shown to the users while the key gets stored in the database.') . '</dd>';
29 $output .= '<dt>' . t('Choosing list field type') . '</dt>'; 30 $output .= '<dt>' . t('Choosing list field type') . '</dt>';
30 $output .= '<dd>' . t('There are three types of list fields, which store different types of data: <em>float</em>, <em>integer</em> or, <em>text</em>. The <em>float</em> type allows storing approximate decimal values. The <em>integer</em> type allows storing whole numbers, such as years (for example, 2012) or values (for example, 1, 2, 5, 305). The <em>text</em> list field type allows storing text values. No matter which type of list field you choose, you can define whatever labels you wish for data entry.') . '</dd>'; 31 $output .= '<dd>' . t('There are three types of list fields, which store different types of data: <em>float</em>, <em>integer</em> or, <em>text</em>. The <em>float</em> type allows storing approximate decimal values. The <em>integer</em> type allows storing whole numbers, such as years (for example, 2012) or values (for example, 1, 2, 5, 305). The <em>text</em> list field type allows storing text values. No matter which type of list field you choose, you can define whatever labels you wish for data entry.') . '</dd>';
31 $output .= '</dl>'; 32 $output .= '</dl>';