Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New config setting in bootstrap_barrio 5.5.13 #40

Open
aksm opened this issue Sep 27, 2023 · 7 comments
Open

New config setting in bootstrap_barrio 5.5.13 #40

aksm opened this issue Sep 27, 2023 · 7 comments
Labels
Bootstrap 5 yet another update, yet another deprecation bug Something isn't working External Bug They/Them
Milestone

Comments

@aksm
Copy link
Contributor

aksm commented Sep 27, 2023

What?

Because there is a new config setting bootstrap_barrio_button_type: 'primary' added as of bootstrap_barrio 5.5.13, a composer update will muck up the settings. Adding the new setting to our configs here, archipelago-deployment, and archipelago-deployment-live resolves the issue.

@aksm aksm added bug Something isn't working Bootstrap 5 yet another update, yet another deprecation labels Sep 27, 2023
@aksm aksm self-assigned this Sep 27, 2023
@DiegoPino
Copy link
Member

@aksm can you please point us to where in the code /how that unrelated config hits the fan? Thanks

@DiegoPino DiegoPino added the External Bug They/Them label Sep 27, 2023
@DiegoPino DiegoPino added this to the 1.2.0 milestone Sep 27, 2023
@aksm
Copy link
Contributor Author

aksm commented Sep 27, 2023

@DiegoPino Will investigate further, but adding the setting to configs before deploying resolved the issue of buttons not appearing in the webform after composer update.

@aksm
Copy link
Contributor Author

aksm commented Sep 27, 2023

@DiegoPino In bootstrap_barrio.theme (below) after a composer update, the setting is null if it's missing in config so the button can't be generated:

    $button_type = theme_get_setting('bootstrap_barrio_button_type');
    if (is_object($variables['attributes']['class'])) {
      \Drupal::logger('bootstrap_barrio')->notice(implode($variables['attributes']['class']->value()));
      if (!in_array('btn', $variables['attributes']['class']->value())) {
        $variables['attributes']['class']->addClass('btn');
      }
      if (empty(array_intersect($button_types, $variables['attributes']['class']->value()))) {
        if ($button_is_outline) {
          $variables['attributes']['class']->addClass('btn-outline-' . $button_type);
        }
        else {
          $variables['attributes']['class']->addClass('btn-' . $button_type);
        }
      }

@DiegoPino
Copy link
Member

@aksm ok! can you dig deeper? What I see there is what defines the classes. Where is the button not generated at all if no classes?

@aksm
Copy link
Contributor Author

aksm commented Sep 27, 2023

@DiegoPino sorry, I should've added the whole snippet, the above block continues with the following:

      if ($button_size && empty(array_intersect($button_sizes, $variables['attributes']['class']->value()))) {
        $variables['attributes']['class']->addClass($button_size);
      }
    }
    else {
      if (!in_array('btn', $variables['attributes']['class'])) {
        $variables['attributes']['class'][] = 'btn';
      }
      if (empty(array_intersect($button_types, $variables['attributes']['class']))) {
        if ($button_is_outline) {
          $variables['attributes']['class'][] = 'btn-outline-' . $button_type;
        }
        else {
          $variables['attributes']['class'][] = 'btn-' . $button_type;
        }
      }

That very last else is the one affecting the webform.

@DiegoPino
Copy link
Member

@aksm so question. Why do other buttons in other places work? I'm ok with adding "primary" as default for that property, I just don't get why that is an issue. Of course feel free to make pulls for this, just the logic makes no sense to me.

@aksm
Copy link
Contributor Author

aksm commented Sep 27, 2023

@DiegoPino From my testing the other buttons in the webform disappear with a composer update as well.

@aksm aksm removed their assignment Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bootstrap 5 yet another update, yet another deprecation bug Something isn't working External Bug They/Them
Projects
None yet
Development

No branches or pull requests

2 participants