<div class="cta-block">
    <div class="cta-block__wrapper">
        <div class="cta-block__inner">
            <img src="/img/newsletter-icon.png" alt="an image no text" class="cta-block__image margin--right">
            <div class="cta-block__text">
                <h3 class="heading heading--small">Cta block cms</h3>
                <p>Praesent felis magna, cursus eu scelerisque cursus, convallis sodales ex. Suspendisse eu tortor ut erat.</p>
            </div>
            <a href="" class="cta cta--secondary cta--has-shadow ">
            <span class="cta__label">Call-to-action
              <svg data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
                <path d="M14.54 7.63l-1.5 1.13.67 2.21H5.18v2h8.53l-.67 2.2 1.5 1.13 5.32-3.5v-1.67l-5.32-3.5z"/>
              </svg>
            </span>
          </a>
        </div>
    </div>
</div>
  • Content:
    <?php
    
    $ctaBlock = array(
      'key' => 'cta-block',
      'label' => 'CTA Block',
    	'title' => 'CTA Block',
      'name' => 'cta-block', //defines the Twig file you're using
    	'type' => 'group',//<---- this is needed so that it shows on the Add Block Correctly
    	'sub_fields' => array( //<---- this is initially fields, needs to be renamed as sub_fields
    		array(
    			'key' => 'cta-block__btn-position',
    			'label' => 'CTA Button position',
    			'name' => 'btnPosition',
    			'type' => 'select',
    			'instructions' => 'Where would you like the CTA button to display?',
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array(
    				'top' => 'top',
    				'bottom' => 'bottom',
    				'left' => 'left',
    				'right' => 'right'
    			),
    			'default_value' => array(
    				0 => 'right',
    			),
    			'allow_null' => 0,
    			'multiple' => 0,
    			'ui' => 0,
    			'return_format' => 'value',
    			'ajax' => 0,
    			'placeholder' => '',
    		),
    		array(
    			'key' => 'cta-block__theme',
    			'label' => 'Theme',
    			'name' => 'theme',
    			'type' => 'radio',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array(
    				'default' => 'Default',
    				'white' => 'White',
    			),
    			'allow_null' => 0,
    			'other_choice' => 0,
    			'default_value' => '',
    			'layout' => 'horizontal',
    			'return_format' => 'value',
    			'save_other_choice' => 0,
    		),
    		array(
    			'key' => 'cta-block__heading',
    			'label' => 'CTA Block Heading',
    			'name' => 'ctaBlockHeading',
    			'type' => 'text',
    			'instructions' => '',
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'prepend' => '',
    			'append' => '',
    			'maxlength' => '',
    		),
    		array(
    			'key' => 'cta-block__text',
    			'label' => 'CTA Block Text',
    			'name' => 'ctaBlockText',
    			'type' => 'textarea',
    			'instructions' => '',
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'maxlength' => '',
    			'rows' => '',
    			'new_lines' => '',
    		),
    		array(
    			'key' => 'cta-block__image',
    			'label' => 'CTA Block Image',
    			'name' => 'ctaBlockImage',
    			'type' => 'image',
    			'instructions' => '',
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'return_format' => 'array',
    			'preview_size' => 'thumbnail',
    			'library' => 'all',
    			'min_width' => '',
    			'min_height' => '',
    			'min_size' => '',
    			'max_width' => '',
    			'max_height' => '',
    			'max_size' => '',
    			'mime_types' => '',
    		),
    		array(
    			'key' => 'cta-block__button',
    			'label' => 'CTA Block Button Link',
    			'name' => 'ctaBlockBtn',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
        ),
        array(
    			'key' => 'cta-block__btnText',
    			'label' => 'CTA Block Button Text',
    			'name' => 'ctaBlockBtnText',
    			'type' => 'text',
    			'instructions' => '',
    			'conditional_logic' => 0,
    			'wrapper' => array(
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'prepend' => '',
    			'append' => '',
    			'maxlength' => '',
        ),
        array(
          'key' => 'cta-block__samewidth',
          'label' => 'Make all CTA buttons on this page the same width',
          'name' => 'ctaBlockSameWidth',
          'type' => 'true_false',
          'instructions' => '',
          'required' => 0,
          'wrapper' => array(
            'width' => '',
            'class' => '',
            'id' => '',
          ),
          'message' => '',
          'default_value' => 0,
          'ui' => 1,
          'ui_on_text' => '',
          'ui_off_text' => '',
        ),
    	),
      'row_min' => 0,
      'row_limit' => '',
      'layout' => 'row'
    );
    
    array_push($_SESSION["blocks"], $ctaBlock);
  • URL: /components/raw/cta-block-cms/cta-block-cms.php
  • Filesystem Path: src/components/cms-blocks/cta-block-cms/cta-block-cms.php
  • Size: 4.1 KB