Discovered a minor bug with an easy fix. I have a sub-theme based off of Bootstrap, and in it I want to enable the "bootstrap_fluid_container" setting by default. So I put the following in my theme's .info file:

; Container
; --------------
settings[bootstrap_fluid_container] = 1

On a new install, this does not work. If I go to the theme settings form, however, the fluid container option IS CHECKED. But it does not take affect until after I click save on the settings form.

This is happening because that setting is being checked with a triple-equals operator (===) in page.vars.php (in two places):

  if(bootstrap_setting('fluid_container') === 1) {

You would think that would work, but when the setting is loaded from the default theme settings, it's a string not an integer, so that condition fails.

Therefore, my proposed solution is to change it to a double-equals operator (==). Patch on the way!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Status: Active » Needs review
FileSize
904 bytes

Patch attached.

  • markcarver committed 104503b on 7.x-3.x authored by m.stenta
    Issue #2556603 by m.stenta: Fluid container theme setting default
    
markhalliwell’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Assigned: Unassigned » neardark
Priority: Minor » Major
Status: Needs review » Patch (to be ported)

Actually just ran into this too. Thanks for the patch @m.stenta!

@neardark, so I tried applying this to 8.x, but it turns out that the work you did in #2474771: Clean up Bootstrap Settings code reverted the container-fluid stuff from #2260199: Add toggle for .container or .container-fluid in Grid settings: http://cgit.drupalcode.org/bootstrap/diff/templates/system/page.vars.php...

Assigning to you.

markhalliwell’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev
Assigned: neardark » Unassigned
Priority: Major » Minor
Status: Patch (to be ported) » Closed (fixed)