diff --git a/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php b/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php index d55fcd5b81ed0c1702b5f64a62e9d3fac5efb40e..126f27b12c1d66bb042640ef114a4e798a2253be 100644 --- a/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php @@ -652,13 +652,21 @@ class LayoutParagraphsWidget extends WidgetBase implements ContainerFactoryPlugi } else { // Add the #isTranslating attribute, if in a translation context. + $elements['is_translating_warning'] = [ + '#type' => "html_tag", + '#tag' => 'div', + '#value' => t("This is Translation Context (editing a version not in the original language). <b>No new Layout Sections and Paragraphs can be added</b>."), + '#weight' => -1100, + '#attributes' => [ + 'class' => ['is_translating_warning'], + ], + ]; $elements['add_more'] = [ 'actions' => [ '#isTranslating' => TRUE, ], ]; } - if ($widget_state['open_form'] !== FALSE) { $this->entityForm($elements, $form_state, $form); } @@ -2062,6 +2070,14 @@ class LayoutParagraphsWidget extends WidgetBase implements ContainerFactoryPlugi /** * Field instance settings form. + * + * @param array $form + * The Form element. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + * + * @return array + * The Form array. */ public function settingsForm(array $form, FormStateInterface $form_state) { $entity_type_id = $this->getFieldSetting('target_type'); @@ -2141,6 +2157,9 @@ class LayoutParagraphsWidget extends WidgetBase implements ContainerFactoryPlugi /** * Default settings for widget. + * + * @return array + * The default settings array. */ public static function defaultSettings() { $defaults = parent::defaultSettings();