comparison core/modules/block_content/block_content.module @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
3 /** 3 /**
4 * @file 4 * @file
5 * Allows the creation of custom blocks through the user interface. 5 * Allows the creation of custom blocks through the user interface.
6 */ 6 */
7 7
8 use Drupal\Core\Url;
8 use Drupal\Core\Routing\RouteMatchInterface; 9 use Drupal\Core\Routing\RouteMatchInterface;
9 use Drupal\field\Entity\FieldConfig; 10 use Drupal\field\Entity\FieldConfig;
10 use Drupal\field\Entity\FieldStorageConfig; 11 use Drupal\field\Entity\FieldStorageConfig;
11 use Drupal\Core\Database\Query\SelectInterface; 12 use Drupal\Core\Database\Query\SelectInterface;
12 use Drupal\Core\Database\Query\AlterableInterface; 13 use Drupal\Core\Database\Query\AlterableInterface;
16 * Implements hook_help(). 17 * Implements hook_help().
17 */ 18 */
18 function block_content_help($route_name, RouteMatchInterface $route_match) { 19 function block_content_help($route_name, RouteMatchInterface $route_match) {
19 switch ($route_name) { 20 switch ($route_name) {
20 case 'help.page.block_content': 21 case 'help.page.block_content':
21 $field_ui = \Drupal::moduleHandler()->moduleExists('field_ui') ? \Drupal::url('help.page', ['name' => 'field_ui']) : '#'; 22 $field_ui = \Drupal::moduleHandler()->moduleExists('field_ui') ? Url::fromRoute('help.page', ['name' => 'field_ui'])->toString() : '#';
22 $output = ''; 23 $output = '';
23 $output .= '<h3>' . t('About') . '</h3>'; 24 $output .= '<h3>' . t('About') . '</h3>';
24 $output .= '<p>' . t('The Custom Block module allows you to create and manage custom <em>block types</em> and <em>content-containing blocks</em> from the <a href=":block-library">Custom block library</a> page. Custom block types have fields; see the <a href=":field-help">Field module help</a> for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the <a href=":blocks">Block module help</a> page for details. For more information, see the <a href=":online-help">online documentation for the Custom Block module</a>.', [':block-library' => \Drupal::url('entity.block_content.collection'), ':block-content' => \Drupal::url('entity.block_content.collection'), ':field-help' => \Drupal::url('help.page', ['name' => 'field']), ':blocks' => \Drupal::url('help.page', ['name' => 'block']), ':online-help' => 'https://www.drupal.org/documentation/modules/block_content']) . '</p>'; 25 $output .= '<p>' . t('The Custom Block module allows you to create and manage custom <em>block types</em> and <em>content-containing blocks</em> from the <a href=":block-library">Custom block library</a> page. Custom block types have fields; see the <a href=":field-help">Field module help</a> for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the <a href=":blocks">Block module help</a> page for details. For more information, see the <a href=":online-help">online documentation for the Custom Block module</a>.', [':block-library' => Url::fromRoute('entity.block_content.collection')->toString(), ':block-content' => Url::fromRoute('entity.block_content.collection')->toString(), ':field-help' => Url::fromRoute('help.page', ['name' => 'field'])->toString(), ':blocks' => Url::fromRoute('help.page', ['name' => 'block'])->toString(), ':online-help' => 'https://www.drupal.org/documentation/modules/block_content']) . '</p>';
25 $output .= '<h3>' . t('Uses') . '</h3>'; 26 $output .= '<h3>' . t('Uses') . '</h3>';
26 $output .= '<dl>'; 27 $output .= '<dl>';
27 $output .= '<dt>' . t('Creating and managing custom block types') . '</dt>'; 28 $output .= '<dt>' . t('Creating and managing custom block types') . '</dt>';
28 $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create and edit custom block types with fields and display settings, from the <a href=":types">Block types</a> page in the Custom block library. For more information about managing fields and display settings, see the <a href=":field-ui">Field UI module help</a>.', [':types' => \Drupal::url('entity.block_content_type.collection'), ':field-ui' => $field_ui]) . '</dd>'; 29 $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create and edit custom block types with fields and display settings, from the <a href=":types">Block types</a> page in the Custom block library. For more information about managing fields and display settings, see the <a href=":field-ui">Field UI module help</a>.', [':types' => Url::fromRoute('entity.block_content_type.collection')->toString(), ':field-ui' => $field_ui]) . '</dd>';
29 $output .= '<dt>' . t('Creating custom blocks') . '</dt>'; 30 $output .= '<dt>' . t('Creating custom blocks') . '</dt>';
30 $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create, edit, and delete custom blocks of each defined custom block type, from the <a href=":block-library">Blocks</a> page in the Custom block library. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page; see the <a href=":block_help">Block module help</a> for more information about placing blocks.', [':blocks' => \Drupal::url('block.admin_display'), ':block-library' => \Drupal::url('entity.block_content.collection'), ':block_help' => \Drupal::url('help.page', ['name' => 'block'])]) . '</dd>'; 31 $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create, edit, and delete custom blocks of each defined custom block type, from the <a href=":block-library">Blocks</a> page in the Custom block library. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page; see the <a href=":block_help">Block module help</a> for more information about placing blocks.', [':blocks' => Url::fromRoute('block.admin_display')->toString(), ':block-library' => Url::fromRoute('entity.block_content.collection')->toString(), ':block_help' => Url::fromRoute('help.page', ['name' => 'block'])->toString()]) . '</dd>';
31 $output .= '</dl>'; 32 $output .= '</dl>';
32 return $output; 33 return $output;
33 34
34 case 'entity.block_content.collection': 35 case 'entity.block_content.collection':
35 $output = '<p>' . t('Blocks in the block library belong to <a href=":types">Custom block types</a>, each with its own fields and display settings. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page.', [':types' => \Drupal::url('entity.block_content_type.collection'), ':blocks' => \Drupal::url('block.admin_display')]) . '</p>'; 36 $output = '<p>' . t('Blocks in the block library belong to <a href=":types">Custom block types</a>, each with its own fields and display settings. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page.', [':types' => Url::fromRoute('entity.block_content_type.collection')->toString(), ':blocks' => Url::fromRoute('block.admin_display')->toString()]) . '</p>';
36 return $output; 37 return $output;
37 38
38 case 'entity.block_content_type.collection': 39 case 'entity.block_content_type.collection':
39 $output = '<p>' . t('Each block type has its own fields and display settings. Create blocks of each type on the <a href=":block-library">Blocks</a> page in the custom block library.', [':block-library' => \Drupal::url('entity.block_content.collection')]) . '</p>'; 40 $output = '<p>' . t('Each block type has its own fields and display settings. Create blocks of each type on the <a href=":block-library">Blocks</a> page in the custom block library.', [':block-library' => Url::fromRoute('entity.block_content.collection')->toString()]) . '</p>';
40 return $output; 41 return $output;
41 42
42 } 43 }
43 } 44 }
44 45