Variants do not override the title and description

Created on 4 February 2025, 3 months ago

Problem/Motivation

Currently, everything else on a webform can be overridden with exception to the title and description. This is something that is needed as sites might create variants that should have different title and description based on conditions like domain or language, etc.

Steps to reproduce

Add a new webform variant that overrides the title and description. In `buildConfigurationForm()`

    $form['overrides']['title'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Title'),
      '#description' => $this->t('Enter the overridden title of the webform.'),
      '#default_value' => $this->configuration['title'] ?? NULL,
      '#weight' => -10,
    ];

    $form['overrides']['description'] = [
      '#type' => 'textarea',
      '#title' => $this->t('Description'),
      '#description' => $this->t('Enter the overridden description of the webform.'),
      '#default_value' => $this->configuration['description'] ?? NULL,
      '#weight' => -5,
    ];

In `submitConfigurationForm()`:

    $this->configuration['title'] = $this->configuration['overrides']['title'];
    $this->configuration['description'] = $this->configuration['overrides']['description'];

Proposed resolution

Alter `applyVariant()` function to override the title and description if an override exists for the variant.

📌 Task
Status

Active

Version

5.0

Component

Code

Created by

🇮🇳India shabana.navas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024