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)) {

    


use MVRK\Icenberg\Icenberg;

$ice = new Icenberg($layout = 'block_name', $prefix = 'block', $post_id = false);



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;

$ice = new Icenberg(get_row_layout());

$ice->the_element('quote');
$ice->the_element('attribution');
$ice->the_element('portrait');


use MVRK\Icenberg\Icenberg;

$icenberg = new Icenberg(strtolower($block['title']));

$icenberg::wrap(
    [
        $icenberg->get_element('quote'),
        $icenberg->get_element('attribution'),
        $icenberg->get_element('portrait'),
    ],
    $block,
    true
);



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

echo $field_name;



$ice->the_element('field_name');



$ice->the_element('field_name, options');



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



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

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


$lady_in_red = $ice->value('dancing_with_me');

 $ice->field($field_name)
 

$ice->field('saxaphone')->get()

$group = $ice->field('bad_singers')->prune(['chris_de_burgh', 'cliff_richard'])->get();


$group = $ice->field('great_singers')->only(['chris_de_burgh'])->get('marquee');


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

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


function acf_google_map_field($api)
{
    $api['key'] = GOOGLE_MAPS_API_KEY;

    return $api;
}
add_filter('acf/fields/google_map/api', 'acf_google_map_field');

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

$block_settings = get_sub_field($block_settings);

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

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

$is_wp_cli = defined('WP_CLI') && WP_CLI;

if ($is_wp_cli) {
    \MVRK\Icenberg\Commands\Bootstrap::setup();
}
html

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

<div  echo $settings;