Skip to content

Commit

Permalink
HKI-766-71354 setting element readonly by default
Browse files Browse the repository at this point in the history
  • Loading branch information
stankut committed Apr 3, 2020
1 parent f5e0e66 commit 1b2a224
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function getDefaultProperties() {
'minlength' => '',
'maxlength' => '',
'placeholder' => '',
'readonly' => '',
];

return $properties;
Expand Down Expand Up @@ -110,9 +111,9 @@ public function form(array $form, FormStateInterface $form_state) {

// @see \Drupal\webform\Plugin\WebformElement\WebformEntityReferenceTrait::form
$element_properties = $form_state->get('element_properties');
// If element is new, set disabled by default.
// If element is new, set readonly by default.
if (empty($element_properties['title'])) {
$form['form']['disabled']['#value'] = TRUE;
$form['form']['readonly']['#value'] = TRUE;
}

// Here you can define and alter a webform element's properties UI.
Expand Down

0 comments on commit 1b2a224

Please sign in to comment.