lib.contentElement {
  templateRootPaths.10 = EXT:bgm_theme_azh/Resources/Private/Templates/
  partialRootPaths.10 = EXT:bgm_theme_azh/Resources/Private/Partials/
  layoutRootPaths.10 = EXT:bgm_theme_azh/Resources/Private/Layouts/
}

lib.twigContentElement = TWIGTEMPLATE
lib.twigContentElement {
  namespaces {
    src {
      10 = EXT:bgm_theme_azh/Resources/Public/Templates/azh/
    }

    base {
      10 = EXT:bgm_theme_azh/Resources/Public/Templates/azh/base/
    }

    elements {
      10 = EXT:bgm_theme_azh/Resources/Public/Templates/azh/elements/
    }

    global {
      10 = EXT:bgm_theme_azh/Resources/Public/Templates/azh/global/
    }
  }

  templateRootPaths {
    10 = EXT:cvc_twig/Resources/Private/TwigTemplates
    20 = EXT:bgm_theme_azh/Resources/Public/Templates/azh/
    30 = EXT:bgm_theme_azh/Resources/Public/Templates/bgm/
  }

  // ButtonGroup
  dataProcessing {
    10 = Bgm\BgmThemeAzh\DataProcessing\ButtonArrayProcessor
  }

  variables {
    jumpmarkAnchorId = TEXT
    jumpmarkAnchorId {
      field = uid
      wrap = c|
    }


    brickContainer {
      wrapped = true
      tag = section

      theme = TEXT
      theme.field = layout

      variant = TEXT
      variant.field = frame_class

      bgColor = TEXT
      bgColor.field = bg_color

      spacingTop = TEXT
      spacingTop.value =
      spacingTop.override.field = space_before_class
      spacingTop.override.if {
        value = no-space
        equals.field = space_before_class
        negate = 1
      }

      spacingBottom = TEXT
      spacingBottom.value =
      spacingBottom.override.field = space_after_class
      spacingBottom.override.if {
        value = no-space
        equals.field = space_after_class
        negate = 1
      }


      bgImage {
        html =< lib.contentElement
        html {
          templateRootPaths.10 = EXT:bgm_theme_azh/Resources/Private/Templates/
          partialRootPaths.10 = EXT:bgm_theme_azh/Resources/Private/Partials/
          templateName = TwigImage

          dataProcessing {
            10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
            10 {
              references.fieldName = bg_image
              if.isTrue.field = bg_image
            }
          }
        }
      }
    }
  }
}

lib.heading {
  headline {
    text = TEXT
    text.field = header
    # If-Bedingung auf oberster Ebene, damit das gesamte lib.heading-Objekt bei hidden entfällt
    text.if {
      value = hidden
      equals.field = header_layout
      negate = 1
    }


    markup = TEXT
    markup.field = header_layout

    solid = CASE
    solid {
      key.field = header_solid
      default = TEXT
      default.value = 0
      1 = TEXT
      1.value = true
    }


    style = TEXT
    style.field = header_style
  }

  align = TEXT
  align.field = header_position

  subline = TEXT
  subline.field = subheader

  topline = TEXT
  topline.field = topline
}

lib.copy {
  text = TEXT
  text.field = bodytext
  text.parseFunc < lib.parseFunc_RTE
}

lib.buttonGroup {
  isStretched = TEXT
  isStretched.field = buttongroup_isstretched
  isVertical = TEXT
  isVertical.field = buttongroup_isvertical
}

lib.ContentBase {
  heading < lib.heading
  copy < lib.copy
  alignment = TEXT
  alignment.field = text_alignment
  buttonGroup < lib.buttonGroup
}

# Lean TWIGTEMPLATE (same namespaces and paths, no variables) for rendering single atoms inside TypoScript
lib.twigAtom = TWIGTEMPLATE
lib.twigAtom {
  namespaces < lib.twigContentElement.namespaces
  templateRootPaths < lib.twigContentElement.templateRootPaths
}
