Skip to content

Commit

Permalink
Merge pull request #794 from UN-OCHA/berliner/HPC-9269
Browse files Browse the repository at this point in the history
HPC-9269: Make article short title optional to unblock updates to article pages
  • Loading branch information
berliner authored Nov 10, 2023
2 parents 4aff40b + 233a64a commit 51342d8
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 34 deletions.
18 changes: 1 addition & 17 deletions config/core.entity_view_display.node.article.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,7 @@ third_party_settings:
layout_settings:
label: Content
context_mapping: { }
components:
8f0e42b8-302c-435f-877f-0b65259f3ef5:
uuid: 8f0e42b8-302c-435f-877f-0b65259f3ef5
region: content
configuration:
id: 'field_block:node:article:field_short_title'
label_display: '0'
context_mapping:
entity: layout_builder.entity
formatter:
type: string
label: above
settings:
link_to_entity: false
third_party_settings: { }
weight: 0
additional: { }
components: { }
third_party_settings: { }
layout_builder_restrictions:
allowed_block_categories:
Expand Down
2 changes: 1 addition & 1 deletion config/field.field.node.article.field_short_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ entity_type: node
bundle: article
label: 'Short title'
description: ''
required: true
required: false
translatable: false
default_value: { }
default_value_callback: ''
Expand Down
6 changes: 3 additions & 3 deletions config/search_api.index.solr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ field_settings:
datasource_id: 'entity:node'
property_path: 'field_tags:entity:name'
type: text
boost: !!float 21
boost: 21.0
dependencies:
config:
- field.storage.node.field_tags
Expand Down Expand Up @@ -99,7 +99,7 @@ field_settings:
datasource_id: 'entity:node'
property_path: title
type: text
boost: !!float 13
boost: 13.0
dependencies:
module:
- node
Expand Down Expand Up @@ -157,7 +157,7 @@ processor_settings:
all_fields: false
fields:
- name
ignorable: '[''¿¡!?,.:;]'
ignorable: "['¿¡!?,.:;]"
ignorable_classes:
- Pc
- Pd
Expand Down
16 changes: 8 additions & 8 deletions config/search_api.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cron_worker_runtime: 15
default_tracker: default
tracking_page_size: 100
boost_factors:
- !!float 0
- 0.0
- 0.1
- 0.2
- 0.3
Expand All @@ -14,15 +14,15 @@ boost_factors:
- 0.7
- 0.8
- 0.9
- !!float 1
- 1.0
- 1.1
- 1.2
- 1.3
- 1.4
- 1.5
- !!float 2
- !!float 3
- !!float 5
- !!float 8
- !!float 13
- !!float 21
- 2.0
- 3.0
- 5.0
- 8.0
- 13.0
- 21.0
3 changes: 1 addition & 2 deletions config/search_api_solr.solr_field_type.text_fr_6_0_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -592,5 +592,4 @@ text_files:
"\u016B" => "u"
synonyms: |
drupal, durpal
nouns: |
nouns: ''
3 changes: 1 addition & 2 deletions config/search_api_solr.solr_field_type.text_fr_7_0_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -596,5 +596,4 @@ text_files:
"\u016B" => "u"
synonyms: |
drupal, durpal
nouns: |
nouns: ''
11 changes: 11 additions & 0 deletions html/modules/custom/ghi_content/src/Entity/ContentBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ public function toUrl($rel = 'canonical', array $options = []) {
return parent::toUrl($rel, $options);
}

/**
* {@inheritdoc}
*/
public function toLink($text = NULL, $rel = 'canonical', array $options = []) {
if (!isset($text)) {
// Use the short title as default.
$text = $this->getShortTitle() ?? NULL;
}
return parent::toLink($text, $rel, $options);
}

/**
* Get the short title for a document.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getTitle() {
* {@inheritdoc}
*/
public function getShortTitle() {
return trim($this->data->title_short);
return trim($this->data->title_short ?? '');
}

/**
Expand Down

0 comments on commit 51342d8

Please sign in to comment.