Commit 7ec5d8e2 authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3270211 by RenatoG: Make bulk operations to be consider the settings on...

Issue #3270211 by RenatoG: Make bulk operations to be consider the settings on fieldtype and maxlengh of settings page
parent bb07e98c
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -102,6 +102,9 @@ class BlockClassBulkOperationsForm extends ConfigFormBase {
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    // Get config object.
    $config = $this->configFactory->getEditable('block_class.settings');

    $form['operation'] = [
      '#title' => $this->t("Operation"),
      '#type' => 'select',
@@ -114,10 +117,27 @@ class BlockClassBulkOperationsForm extends ConfigFormBase {
      ],
    ];

    // Default field type.
    $field_type = 'textfield';

    // Default value for maxlength.
    $maxlength_block_class_field = 255;

    // Get the field type if exists.
    if (!empty($config->get('field_type'))) {
      $field_type = $config->get('field_type');
    }

    // Get maxlength if exists.
    if (!empty($config->get('maxlength_block_class_field'))) {
      $maxlength_block_class_field = $config->get('maxlength_block_class_field');
    }

    $form['classes_to_be_added'] = [
      '#title' => $this->t("Classes to be added"),
      '#type' => 'textfield',
      '#type' => $field_type,
      '#description' => $this->t("Customize the styling of all blocks by adding CSS classes. Separate multiple classes by spaces."),
      '#maxlength' => $maxlength_block_class_field,
      '#states' => [
        'visible' => [
          ':input[name="operation"]' => [