Skip to content
Snippets Groups Projects
Commit 975f6818 authored by AdamPS's avatar AdamPS
Browse files

Rename the formatter

parent a5111ce4
No related branches found
No related tags found
No related merge requests found
......@@ -31,11 +31,7 @@ function manage_display_entity_base_field_info_alter(&$base_field_definitions, E
function manage_display_base_field_info($entity_type_id) {
$info['node']['title'] = [
'label' => 'hidden',
'type' => 'linked_and_wrapped',
'settings' => [
'tag' => 'h2',
'linked' => '1',
],
'type' => 'title',
'weight' => -5,
];
......
......@@ -9,17 +9,17 @@ use Drupal\Core\Routing\LinkGeneratorTrait;
use Drupal\Core\Template\Attribute;
/**
* A field formatter for linking and wrapping text.
* A field formatter for entity titles.
*
* @FieldFormatter(
* id = "linked_and_wrapped",
* label = @Translation("Linked & Wrapped"),
* id = "title",
* label = @Translation("Title"),
* field_types = {
* "string"
* }
* )
*/
class LinkedAndWrapped extends BasicStringFormatter {
class TitleFormatter extends BasicStringFormatter {
use LinkGeneratorTrait;
......@@ -89,14 +89,14 @@ class LinkedAndWrapped extends BasicStringFormatter {
$form['tag'] = [
'#title' => $this->t('Tag'),
'#type' => 'select',
'#description' => $this->t('Select the tag which will be wrapped around the text.'),
'#description' => $this->t('Select the tag which will be wrapped around the title.'),
'#options' => $heading_options,
'#default_value' => $this->getSetting('tag'),
];
$form['linked'] = [
'#title' => $this->t('Link to the Content'),
'#type' => 'checkbox',
'#description' => $this->t('Wrap the text with a link to the content.'),
'#description' => $this->t('Wrap the title with a link to the content.'),
'#default_value' => $this->getSetting('linked'),
];
$form['classes'] = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment