PHP code example of mvrk / icenberg

1. Go to this page and download the library: Download mvrk/icenberg library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mvrk / icenberg example snippets



$composer_path = $_SERVER['DOCUMENT_ROOT'] . '/../vendor/';

if (file_exists($composer_path)) {

    


if (have_rows('content_blocks', $id)) :

    while (have_rows('content_blocks', $id)) : the_row();

        get_template_part('inc/blocks/block_template');

    endwhile;

endif;


use MVRK\Icenberg\Icenberg;

$icenberg = new Icenberg(get_row_layout());



$field_name = $icenberg->get_element('field_name');

echo $field_name;



$icenberg->the_element('field_name');



$icenberg->enclose('text', [
    $icenberg->get_element('cta_heading')
    $icenberg->get_element('cta_content'),
]);



$random_text = "<span>I am some random text, isn't it wonderful?</span>";

$icenberg->enclose('text', [
    $icenberg->get_element('cta_heading'),
    $random_text
]);


$classes = ['banana', 'orange'];

$block_settings = get_sub_field($block_settings);

$settings = $icenberg->settings($block_settings, $classes);

$icenberg->enclose ($settings, [
    $icenberg->get_element('cheese_board'),
    $icenberg->get_element('flame_thrower')
])

 $icenberg->field($field_name)
 

 if ($icenberg->field('font_colour')->is('red')) :
    $icenberg->the_element('font_colour');
else :
    echo 'oh no';
endif;

if ($icenberg->field('range_test')->lessThan(51)) :
    $class = 'text_' . $icenberg->field('range_test')->field;
    $icenberg->enclose($class, [
        $icenberg->get_element('cta_content'),
        $icenberg->get_element('cta_image'),
    ]);
endif;
html

<div class="testimonial__corner-illustration_green_reversed">
     if($motif_variation_5_purple === 'orange') :
    $icenberg->the_element('motif_blurple');
    endif; 
html

<div  echo $settings;