Commit 450d02a8 authored by dmitriy.trt's avatar dmitriy.trt Committed by Anna Kalata
Browse files

Issue #3206374 by Dmitriy.trt, barone, gngn, monojithalder: Title of a menu is...

Issue #3206374 by Dmitriy.trt, barone, gngn, monojithalder: Title of a menu is not saved properly when left blank
parent e62eac91
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ class BookSitemapDeriver extends DeriverBase implements ContainerDeriverInterfac
        $this->derivatives[$id] = $base_plugin_definition;
        $this->derivatives[$id]['title'] = $this->t('Book: @book', ['@book' => $book['title']]);
        $this->derivatives[$id]['description'] = $book['type'];
        $this->derivatives[$id]['settings']['title'] = '';
        $this->derivatives[$id]['settings']['title'] = NULL;
        $this->derivatives[$id]['book'] = $id;
        $this->derivatives[$id]['config_dependencies']['config'] = ['book.settings'];
      }
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ class MenuSitemapDeriver extends DeriverBase implements ContainerDeriverInterfac
      $this->derivatives[$menu] = $base_plugin_definition;
      $this->derivatives[$menu]['title'] = $this->t('Menu: @menu', ['@menu' => $entity->label()]);
      $this->derivatives[$menu]['description'] = $entity->getDescription();
      $this->derivatives[$menu]['settings']['title'] = '';
      $this->derivatives[$menu]['settings']['title'] = NULL;
      $this->derivatives[$menu]['menu'] = $entity->id();
      $this->derivatives[$menu]['config_dependencies']['config'] = [$entity->getConfigDependencyName()];
    }
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class VocabularySitemapDeriver extends DeriverBase implements ContainerDeriverIn
        $this->derivatives[$id] = $base_plugin_definition;
        $this->derivatives[$id]['title'] = $this->t('Vocabulary: @vocabulary', ['@vocabulary' => $vocabulary->label()]);
        $this->derivatives[$id]['description'] = $vocabulary->getDescription();
        $this->derivatives[$id]['settings']['title'] = '';
        $this->derivatives[$id]['settings']['title'] = NULL;
        $this->derivatives[$id]['vocabulary'] = $vocabulary->id();
        $this->derivatives[$id]['config_dependencies']['config'] = [$vocabulary->getConfigDependencyName()];
      }
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ use Drupal\sitemap\SitemapBase;
 *   title = @Translation("Book name"),
 *   description = @Translation("Book type"),
 *   settings = {
 *     "title" = "",
 *     "title" = NULL,
 *     "show_expanded" = TRUE,
 *   },
 *   deriver = "Drupal\sitemap\Plugin\Derivative\BookSitemapDeriver",
@@ -33,7 +33,7 @@ class Book extends SitemapBase {
      // Provide the book name as the default title.
      $bid = $this->getPluginDefinition()['book'];
      $book = \Drupal::entityTypeManager()->getStorage('node')->load($bid);
      $form['title']['#default_value'] = $this->settings['title'] ?: $book->label();
      $form['title']['#default_value'] = $this->settings['title'] ?? $book->label();

      $form['show_expanded'] = [
        '#type' => 'checkbox',
+1 −4
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ use Drupal\Core\Form\FormStateInterface;
 *   title = @Translation("Site front page"),
 *   description = @Translation("Displays a sitemap link for the site front page."),
 *   settings = {
 *     "title" = "Front page",
 *     "title" = @Translation("Front page"),
 *     "rss" = "/rss.xml",
 *   },
 *   enabled = TRUE,
@@ -28,9 +28,6 @@ class Frontpage extends SitemapBase {
  public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);

    // Provide a default title.
    $form['title']['#default_value'] = $this->settings['title'] ?: $this->t('Front page');

    // @todo Convert to route instead of relative html path.
    $form['rss'] = [
      '#type' => 'textfield',
Loading