Commit 4cadfaf0 authored by Dieter Holvoet's avatar Dieter Holvoet
Browse files

Issue #3305936 by DieterHolvoet: Allow changing the 'single' terminology

parent eda36731
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
strict_translation: false
label: Single
label_collection: Singles
label_singular: single node
label_plural: single nodes
label_count:
  singular: '@count single node'
  plural: "@count single nodes"
+35 −0
Original line number Diff line number Diff line
node_singles.settings:
  type: config_object
  label: 'Node Singles Settings'
  mapping:
    strict_translation:
      type: boolean
      label: "Only return the single node if a translation is available in the requested language, don't fallback to the default translation."
    label:
      type: label
      label: 'The human-readable name of a single node.'
      translatable: true
    label_collection:
      type: label
      label: 'The uppercase plural form of the name of a single node.'
      translatable: true
    label_singular:
      type: label
      label: 'The indefinite singular form of the name of a single node.'
      translatable: true
    label_plural:
      type: label
      label: 'The indefinite plural form of the name of a single node.'
      translatable: true
    label_count:
      type: mapping
      label: "The label's definite article form for use with a count of single nodes."
      mapping:
        singular:
          type: label
          label: 'The label for the singular form, with @count as the placeholder for the numeric count.'
          translatable: true
        plural:
          type: label
          label: 'The label for the plural form, with @count as the placeholder for the numeric count.'
          translatable: true
+5 −0
Original line number Diff line number Diff line
node_singles.settings:
  title: 'Settings'
  base_route_name: node_singles.settings
  names:
    - node_singles.settings

node_singles.install

0 → 100644
+31 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Install, update and uninstall functions for the Node Singles module.
 */

/**
 * Set defaults for the new label settings.
 */
function node_singles_update_8001(): void {
  $config = \Drupal::configFactory()->getEditable('node_singles.settings');
  $values = [
    'label' => 'Single',
    'label_collection' => 'Singles',
    'label_singular' => 'single node',
    'label_plural' => 'single nodes',
    'label_count' => [
      'singular' => '@count single node',
      'plural' => '@count single nodes',
    ],
  ];

  foreach ($values as $key => $value) {
    if (!$config->get($key)) {
      $config->set($key, $value);
    }
  }

  $config->save();
}
+7 −2
Original line number Diff line number Diff line
node_singles.content:
  title: 'Singles'
  description: ''
  title: Singles
  route_name: node_singles.overview
  parent: system.admin_content
  weight: -1

node_singles.settings:
  title: Singles
  parent: system.admin_config_content
  description: Node Singles settings.
  route_name: node_singles.settings
Loading