Loading src/Service/BlockClassHelperService.php +21 −9 Original line number Diff line number Diff line Loading @@ -338,10 +338,27 @@ class BlockClassHelperService { if ($form_object instanceof EntityFormInterface) { $qty_classes_per_block = 10; // Get config object. $config = $this->configFactory->getEditable('block_class.settings'); if (!empty($config->get('qty_classes_per_block'))) { $qty_classes_per_block = $config->get('qty_classes_per_block'); } $url_settings_page = Url::fromRoute('block_class.settings')->toString(); $field_group_class = $this->t('Customize the styling of this block by adding CSS classes. The maximum of classes per block is @qty_classes_per_block@ but if you need you can update this value in the <a href="@$url_settings_page@">settings page</a>', [ '@qty_classes_per_block@' => $qty_classes_per_block, '@$url_settings_page@' => $url_settings_page, ]); $form['class'] = [ '#type' => 'details', '#title' => $this->t('Class'), '#open' => TRUE, '#description' => $field_group_class, ]; /** @var \Drupal\block\BlockInterface $block */ Loading @@ -356,9 +373,6 @@ class BlockClassHelperService { // Default value for maxlength. $maxlength_block_class_field = 255; // Get config object. $config = \Drupal::config('block_class.settings'); // Get the field type if exists. if (!empty($config->get('field_type')) && $config->get('field_type') != 'multiple_textfields') { $field_type = $config->get('field_type'); Loading @@ -373,6 +387,10 @@ class BlockClassHelperService { if ($config->get('field_type') == 'textfield' || $config->get('field_type') == 'textarea') { // Remove the help text in the field group because the field will have // their help text. unset($form['class']['#description']); $form['class']['third_party_settings']['block_class']['classes'] = [ '#type' => $field_type, '#title' => $this->t('CSS class(es)'), Loading @@ -394,12 +412,6 @@ class BlockClassHelperService { // Explode by spaces to get all classes in an array. $classes = explode(' ', $classes); $qty_classes_per_block = 10; if (!empty($config->get('qty_classes_per_block'))) { $qty_classes_per_block = $config->get('qty_classes_per_block'); } // Run a for to add 10 multiple fields. for ($index = 0; $index <= ($qty_classes_per_block - 1); $index++) { Loading Loading
src/Service/BlockClassHelperService.php +21 −9 Original line number Diff line number Diff line Loading @@ -338,10 +338,27 @@ class BlockClassHelperService { if ($form_object instanceof EntityFormInterface) { $qty_classes_per_block = 10; // Get config object. $config = $this->configFactory->getEditable('block_class.settings'); if (!empty($config->get('qty_classes_per_block'))) { $qty_classes_per_block = $config->get('qty_classes_per_block'); } $url_settings_page = Url::fromRoute('block_class.settings')->toString(); $field_group_class = $this->t('Customize the styling of this block by adding CSS classes. The maximum of classes per block is @qty_classes_per_block@ but if you need you can update this value in the <a href="@$url_settings_page@">settings page</a>', [ '@qty_classes_per_block@' => $qty_classes_per_block, '@$url_settings_page@' => $url_settings_page, ]); $form['class'] = [ '#type' => 'details', '#title' => $this->t('Class'), '#open' => TRUE, '#description' => $field_group_class, ]; /** @var \Drupal\block\BlockInterface $block */ Loading @@ -356,9 +373,6 @@ class BlockClassHelperService { // Default value for maxlength. $maxlength_block_class_field = 255; // Get config object. $config = \Drupal::config('block_class.settings'); // Get the field type if exists. if (!empty($config->get('field_type')) && $config->get('field_type') != 'multiple_textfields') { $field_type = $config->get('field_type'); Loading @@ -373,6 +387,10 @@ class BlockClassHelperService { if ($config->get('field_type') == 'textfield' || $config->get('field_type') == 'textarea') { // Remove the help text in the field group because the field will have // their help text. unset($form['class']['#description']); $form['class']['third_party_settings']['block_class']['classes'] = [ '#type' => $field_type, '#title' => $this->t('CSS class(es)'), Loading @@ -394,12 +412,6 @@ class BlockClassHelperService { // Explode by spaces to get all classes in an array. $classes = explode(' ', $classes); $qty_classes_per_block = 10; if (!empty($config->get('qty_classes_per_block'))) { $qty_classes_per_block = $config->get('qty_classes_per_block'); } // Run a for to add 10 multiple fields. for ($index = 0; $index <= ($qty_classes_per_block - 1); $index++) { Loading