Bootstrap 3 Spaltenelemente in Typo3

Ich setze bei meinen Projekten ganz gerne auf die Lösung von  Stefan Schäfer / merec.org, um Spaltenelemente basierend auf Bootstrap 3 Klassen zu realisieren.

Aufgrund der Anforderung, dass die Redakteure das Aussehen der Inhalte, im speziellen Fall auch der Bootstrap Spalten, anpassen sollen, habe ich das Typoscript Setup von Stefan noch etwas erweitert bzw. geändert.

Die prinzipielle Struktur die ich gerne wollte war:

<div class="container>
  <div class="row undweitereKlassen">
    <div class="col-md-6 usw">INHALTE</div>
    <div class="col-md-6 usw">INHALTE</div>
  </div>
</div>

Folgende Dinge soll der Redakteur beeinflussen können:

  • Ob die Zeile 100% der Seitenbreite einnimmt oder die vordefinierte Inhaltsbreite (aus dem Reiter „Erscheinungsbild“ -> Frame)
  • Abstand davor und Abstand danach (aus dem Reiter „Erscheinungsbild“ -> Space Before / Space After)
  • Hintergrundfarbe der Zeile (aus dem Reiter „Erscheinungsbild“ -> Layout)
<div class="container>   <-- bei 100% diesen DIV nicht rendern
  <div class="row undweitereKlassen">    <--- SpaceBefore, SpaceAfter Klassen, Hintergrundfarbe
    <div class="col-md-6 usw">INHALTE</div>
    <div class="col-md-6 usw">INHALTE</div>
  </div>
</div>

 

Ich habe also beim Typoscript Code von Stefan folgendes ergänzt (heller hinterlegte Zeilen):

plugin.tx_gridelements_pi1.setup.uebb_bootstrap_2col {

  preCObject = LOAD_REGISTER
  preCObject {
    containerClasses.cObject = COA
    containerClasses.cObject {
      10 = TEXT
      10 {
        value = equal-height
        fieldRequired = flexform_equalHeight
        noTrimWrap = | ||
      }
      11 = TEXT
      11 {
        value = v-align-children
        fieldRequired = flexform_verticalAlign
        noTrimWrap = | ||
      }
    
    
      20 = TEXT
      20 {
        field = flexform_visibility_element
        noTrimWrap = | ||
        split {
          token = ,
          cObjNum = 1
          1.current = 1
          1.noTrimWrap = | ||
          }
        }
      30 = CASE
      30 {        
        key.field = layout
        default = TEXT
        default.value =  
        1 = TEXT
        1.value = 
        2 = TEXT
        2.value = bg-primary
        3 = TEXT
        3.value = bg-secondary
        4 = TEXT
        4.value = bg-dark
        5 = TEXT
        5.value = bg-dark bg-dark2
        noTrimWrap = | | |
        }
        
      40 = CASE
      40 {        
        key.field = space_before_class
        default = TEXT
        default.value =
        extra-small = TEXT
        extra-small.value = frame-space-before-extra-small
        extra-small.noTrimWrap = | ||
        small = TEXT
        small.value = frame-space-before-small
        small.noTrimWrap = | ||
        medium = TEXT
        medium.value = frame-space-before-medium
        medium.noTrimWrap = | ||
        large = TEXT
        large.value = frame-space-before-large
        large.noTrimWrap = | ||
        extra-large = TEXT
        extra-large.value = frame-space-before-extra-large
        extra-large.noTrimWrap = | ||
        }
    
      50 = CASE
      50 {        
        key.field = space_after_class
        default = TEXT
        default.value =
        extra-small = TEXT
        extra-small.value = frame-space-after-extra-small
        extra-small.noTrimWrap = | ||
        small = TEXT
        small.value = frame-space-after-small
        small.noTrimWrap = | ||
        medium = TEXT
        medium.value = frame-space-after-medium
        medium.noTrimWrap = | ||
        large = TEXT
        large.value = frame-space-after-large
        large.noTrimWrap = | ||
        extra-large = TEXT
        extra-large.value = frame-space-after-extra-large
        extra-large.noTrimWrap = | ||
        }
    
      stdWrap.insertData = 1
      stdWrap.trim = 1
    }

    containerAttributes.cObject = COA
    containerAttributes.cObject {
      10 = TEXT
      10 {
        data = register: containerClasses
        #noTrimWrap = | class="|"|
        noTrimWrap = | class="row |"|
      }
    }

    outerWrapContainerClasses.cObject = COA
    outerWrapContainerClasses.cObject {

      40 = CASE
      40 {        
        key.field = frame_class
        default = TEXT
        default.value = <div class="container">|</div>
        no-frame = TEXT
        default.value = <div class="container">|</div>
        wide = TEXT
        wide.value = 
        widebg = TEXT
        widebg.value = 
        }
    }

    innerWrapContainerClasses.cObject = COA
    innerWrapContainerClasses.cObject {

      10 = CASE
      10 {        
        key.field = frame_class
        default = TEXT
        default.value = 
        no-frame = TEXT
        default.value =
        wide = TEXT
        wide.value = 
        widebg = TEXT
        widebg.value = <div class="container">|</div>

        }
    }


  wrap = {register: innerWrapContainerClasses}
  wrap.insertData = 1

  wrap2 = <div{register: containerAttributes} wrap>| </div>
  wrap2.insertData = 1

  outerWrap = {register: outerWrapContainerClasses}
  outerWrap.insertData = 1

  columns.0 {

    preCObject = LOAD_REGISTER
    preCObject {
      contentColumnClass.cObject = COA
      contentColumnClass.cObject {
        10 = TEXT
        10 {
          field = flexform_width_column_xs_1
          noTrimWrap = || |
          required = 1
        }

        11 = TEXT
        11 {
          field = flexform_width_column_sm_1
          noTrimWrap = || |
          required = 1
        }

        12 = TEXT
        12 {
          field = flexform_width_column_md_1
          noTrimWrap = || |
          required = 1
        }

        13 = TEXT
        13 {
          field = flexform_width_column_lg_1
          noTrimWrap = || |
          required = 1
        }

        20 = TEXT
        20 {
          field = flexform_visibility_col1
          noTrimWrap = | ||
          split {
            token = ,
            cObjNum = 1
            1.current = 1
            1.noTrimWrap = | ||
          }
        }

        stdWrap.noTrimWrap = | class="|"|
      }
    }

    outerWrap = <div{register: contentColumnClass}> | </div>
    outerWrap.insertData = 1

    renderObj =< tt_content
  }

  columns.1 < .columns.0
  columns.1 {
    preCObject {
      contentColumnClass.cObject {
        10.field = flexform_width_column_xs_2
        11.field = flexform_width_column_sm_2
        12.field = flexform_width_column_md_2
        13.field = flexform_width_column_lg_2
        20.field = flexform_visibility_col2
      }
    }
  }
}

plugin.tx_gridelements_pi1.setup.uebb_bootstrap_3col < plugin.tx_gridelements_pi1.setup.uebb_bootstrap_2col
plugin.tx_gridelements_pi1.setup.uebb_bootstrap_3col {
  columns.2 < .columns.0
  columns.2 {
    preCObject {
      contentColumnClass.cObject {
        10.field = flexform_width_column_xs_3
        11.field = flexform_width_column_sm_3
        12.field = flexform_width_column_md_3
        13.field = flexform_width_column_lg_3
        20.field = flexform_visibility_col3
      }
    }
  }

}

plugin.tx_gridelements_pi1.setup.uebb_bootstrap_4col < plugin.tx_gridelements_pi1.setup.uebb_bootstrap_3col
plugin.tx_gridelements_pi1.setup.uebb_bootstrap_4col {
  columns.3 < .columns.0
  columns.3 {
    preCObject {
      contentColumnClass.cObject {
        10.field = flexform_width_column_xs_4
        11.field = flexform_width_column_sm_4
        12.field = flexform_width_column_md_4
        13.field = flexform_width_column_lg_4
        20.field = flexform_visibility_col4
      }
    }
  }
}

tt_content.gridelements_pi1.20.10.setup {
  uebb_bootstrap_2col < plugin.tx_gridelements_pi1.setup.uebb_bootstrap_2col
  uebb_bootstrap_3col < plugin.tx_gridelements_pi1.setup.uebb_bootstrap_3col
  uebb_bootstrap_4col < plugin.tx_gridelements_pi1.setup.uebb_bootstrap_4col
}

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.