#see https://gitlab.bgm-gmbh.de/nov/templates/azh/-/blob/main/elements/components/c-card/c-card.template.twig?ref_type=heads

tt_content.c-card =< lib.twigContentElement
tt_content.c-card {
  templateName = elements/components/c-card/c-card.template.twig

  dataProcessing {
    /*
problem: if image/icon is set  the card will be rendered with an empty image/icon tag
if an icon is selected
solution: only render image if icon is not set
so the processor just checks if icon ist set and an unset variables.image
*/

    10 = Bgm\BgmThemeAzh\DataProcessing\CardIconProcessor
  }

  variables {
    heading < lib.heading
    copy < lib.copy

    variant = TEXT
    variant.field = layout

    orientation = TEXT
    orientation.field = cardorientation

    image {
      html =< lib.contentElement
      html {
        templateRootPaths.10 = EXT:bgm_theme_azh/Resources/Private/Templates/
        templateName = CardImage
        dataProcessing {
          10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
          10 {
            references.fieldName = media
            if.isTrue.field = media
          }
          20 = Bgm\BgmThemeAzh\DataProcessing\ContainerParentProcessor
        }
        stdWrap.if.isFalse.field = icon_name
      }
    }
    icon {
      name = TEXT
      name.field = icon_name
      name.if.isTrue.field = icon_name
    }
    link {
      anchor {
        text = TEXT
        text.field = link_anchor_text

        target = TEXT
        target {
          value = _blank
          if {
            value.field = link_anchor_href
            contains = t3://
            negate = 1
          }
        }


        href = TEXT
        href {
          typolink {
            parameter.field = link_anchor_href
            returnLast = url

          }
          if.isTrue.field = link_anchor_href
        }

        title = TEXT
        title.field = link_anchor_title
      }
      variant = anchor
      icon {
        name = TEXT
        name.field = link_icon_name
      }
    }
    quoteCopy {
      text = TEXT
      text.field = cardquotecopy_text
    }

  }
}
