Loading src/Form/BlockClassSettingsForm.php +28 −2 Changes for src/Form/BlockClassSettingsForm.php: 28 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -146,7 +146,7 @@ class BlockClassSettingsForm extends ConfigFormBase { } $form['global_settings']['class']['maxlength_block_class_field'] = [ '#title' => $this->t("Maxlength on block class field"), '#title' => $this->t("Maxlength"), '#type' => 'number', '#description' => $this->t('This will be the default maxlength value for the "maxlength" field. The default is 255.'), '#default_value' => $maxlength_block_class_field, Loading Loading @@ -178,13 +178,36 @@ class BlockClassSettingsForm extends ConfigFormBase { } $form['global_settings']['attributes']['field_type_attributes'] = [ '#title' => $this->t("Field Type for Attributes"), '#title' => $this->t("Field Type"), '#type' => 'select', '#options' => [ 'textfield' => $this->t('textfield'), 'textarea' => $this->t('textarea'), ], '#default_value' => $field_type_attributes, '#states' => [ 'visible' => [ ':input[name="enable_attributes"]' => ['checked' => TRUE], ], ], ]; $maxlength_attributes = FALSE; if (!empty($config->get('maxlength_attributes'))) { $maxlength_attributes = $config->get('maxlength_attributes'); } $form['global_settings']['attributes']['maxlength_attributes'] = [ '#title' => $this->t("Maxlength"), '#type' => 'number', '#description' => $this->t('This will be the default maxlength value for the attributes field'), '#default_value' => $maxlength_attributes, '#states' => [ 'visible' => [ ':input[name="enable_attributes"]' => ['checked' => TRUE], ], ], ]; $form['actions'] = [ Loading Loading @@ -232,6 +255,8 @@ class BlockClassSettingsForm extends ConfigFormBase { // Get the maxlength_block_class_field field. $maxlength_block_class_field = $form_state->getValue('maxlength_block_class_field'); $maxlength_attributes = $form_state->getValue('maxlength_attributes'); $allow_only_letters_and_numbers = $form_state->getValue('allow_only_letters_and_numbers'); $enable_attributes = $form_state->getValue('enable_attributes'); Loading Loading @@ -270,6 +295,7 @@ class BlockClassSettingsForm extends ConfigFormBase { $config->set('maxlength_block_class_field', $maxlength_block_class_field); $config->set('allow_only_letters_and_numbers', $allow_only_letters_and_numbers); $config->set('enable_attributes', $enable_attributes); $config->set('maxlength_attributes', $maxlength_attributes); // Save that. $config->save(); Loading src/Service/BlockClassHelperService.php +5 −1 Changes for src/Service/BlockClassHelperService.php: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -338,8 +338,12 @@ class BlockClassHelperService { '#title' => $this->t('Attributes'), '#description' => $this->t('Here you can insert any attributes, use one per line. For example: data-block-type|info'), '#default_value' => $block->getThirdPartySetting('block_class', 'attributes'), '#maxlength' => 255, ]; // Get maxlength if exists. if (!empty($config->get('maxlength_attributes'))) { $form['third_party_settings']['block_class']['attributes']['#maxlength'] = $config->get('maxlength_attributes'); } } if (empty($block->getThirdPartySetting('block_class', 'classes'))) { Loading Loading
src/Form/BlockClassSettingsForm.php +28 −2 Changes for src/Form/BlockClassSettingsForm.php: 28 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -146,7 +146,7 @@ class BlockClassSettingsForm extends ConfigFormBase { } $form['global_settings']['class']['maxlength_block_class_field'] = [ '#title' => $this->t("Maxlength on block class field"), '#title' => $this->t("Maxlength"), '#type' => 'number', '#description' => $this->t('This will be the default maxlength value for the "maxlength" field. The default is 255.'), '#default_value' => $maxlength_block_class_field, Loading Loading @@ -178,13 +178,36 @@ class BlockClassSettingsForm extends ConfigFormBase { } $form['global_settings']['attributes']['field_type_attributes'] = [ '#title' => $this->t("Field Type for Attributes"), '#title' => $this->t("Field Type"), '#type' => 'select', '#options' => [ 'textfield' => $this->t('textfield'), 'textarea' => $this->t('textarea'), ], '#default_value' => $field_type_attributes, '#states' => [ 'visible' => [ ':input[name="enable_attributes"]' => ['checked' => TRUE], ], ], ]; $maxlength_attributes = FALSE; if (!empty($config->get('maxlength_attributes'))) { $maxlength_attributes = $config->get('maxlength_attributes'); } $form['global_settings']['attributes']['maxlength_attributes'] = [ '#title' => $this->t("Maxlength"), '#type' => 'number', '#description' => $this->t('This will be the default maxlength value for the attributes field'), '#default_value' => $maxlength_attributes, '#states' => [ 'visible' => [ ':input[name="enable_attributes"]' => ['checked' => TRUE], ], ], ]; $form['actions'] = [ Loading Loading @@ -232,6 +255,8 @@ class BlockClassSettingsForm extends ConfigFormBase { // Get the maxlength_block_class_field field. $maxlength_block_class_field = $form_state->getValue('maxlength_block_class_field'); $maxlength_attributes = $form_state->getValue('maxlength_attributes'); $allow_only_letters_and_numbers = $form_state->getValue('allow_only_letters_and_numbers'); $enable_attributes = $form_state->getValue('enable_attributes'); Loading Loading @@ -270,6 +295,7 @@ class BlockClassSettingsForm extends ConfigFormBase { $config->set('maxlength_block_class_field', $maxlength_block_class_field); $config->set('allow_only_letters_and_numbers', $allow_only_letters_and_numbers); $config->set('enable_attributes', $enable_attributes); $config->set('maxlength_attributes', $maxlength_attributes); // Save that. $config->save(); Loading
src/Service/BlockClassHelperService.php +5 −1 Changes for src/Service/BlockClassHelperService.php: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -338,8 +338,12 @@ class BlockClassHelperService { '#title' => $this->t('Attributes'), '#description' => $this->t('Here you can insert any attributes, use one per line. For example: data-block-type|info'), '#default_value' => $block->getThirdPartySetting('block_class', 'attributes'), '#maxlength' => 255, ]; // Get maxlength if exists. if (!empty($config->get('maxlength_attributes'))) { $form['third_party_settings']['block_class']['attributes']['#maxlength'] = $config->get('maxlength_attributes'); } } if (empty($block->getThirdPartySetting('block_class', 'classes'))) { Loading