%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/maraton/maraton.eco-n-tech.co.uk/wp-content/themes/maraton/blocks/Testimonials/
Upload File :
Create Path :
Current File : //home/maraton/maraton.eco-n-tech.co.uk/wp-content/themes/maraton/blocks/Testimonials/index.php

<?php

acf_register_block( array(
    'name'            => 'testimonials',
    'title'           => __( 'Testimonials', 'maraton' ),
    'description'     => __( 'Testimonials block', 'maraton' ),
    'render_callback' => 'testimonials_render_callback',
    'category'        => 'maraton-blocks',
    'icon'            => 'editor-quote',
    'keywords'        => array( 'testimonials', 'text', 'content'),
) );

function testimonials_render_callback( $block, $content = '', $is_preview = false ) {

    $context = Timber::context();

    // Store block values.
    $context['block'] = $block;

    // Store field values.
    $context['fields'] = get_fields();

    // Store $is_preview value.
    $context['is_preview'] = $is_preview;

    // build style string
    if (isset($context['fields']['settings']['background_color'])) {
        $context['block']['background_color'] = 'background-color: ' . $context['fields']['settings']['background_color'] . ';';
    }

    // Render the block.
    Timber::render( 'render-template.twig', $context );
}

?>

Zerion Mini Shell 1.0