Created
July 21, 2020 11:04
-
-
Save michaelbragg/b12dcd3d4616f00efc3c2b04a2e372c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Block: Icons | |
| * | |
| * @package EDGE\Toolkit\Components | |
| */ | |
| // Default class to use as base for custom CMS class. | |
| $block_link_classes = [ | |
| 'c-icon-group' | |
| ]; | |
| // Add Classes added via CMS. | |
| if( isset( $block['className'] ) ) { | |
| array_push( | |
| $block_link_classes, | |
| $block['className'] | |
| ); | |
| } | |
| // Get ACF field to check icons have been added. | |
| $edge_icons = $block['data']['icons']; | |
| if ( 0 === $edge_icons ) { | |
| return; | |
| } | |
| ?> | |
| <ul | |
| class="<?php echo esc_attr( implode( ' ', $block_link_classes ) ); ?>" | |
| id="<?php echo esc_attr( $block['id'] ); ?>"> | |
| <?php | |
| for( $counter = 0; $counter < $edge_icons; $counter++ ) : | |
| $icon = $block['data']['icons_' . $counter . '_icon']; | |
| $description = $block['data']['icons_' . $counter . '_description']; | |
| ?> | |
| <li class="c-icon-group__item"> | |
| <figure class="c-icon-group__icon"> | |
| <?php | |
| echo wp_get_attachment_image( | |
| $icon, | |
| 'full', | |
| false, | |
| [ 'class' => 'c-icon c-icon--feature' ] | |
| ); | |
| ?> | |
| </figure> | |
| <div class="c-icon-group__body"> | |
| <?php | |
| echo wp_kses_post( | |
| apply_filters( | |
| 'edge_wysiwyg_field', | |
| $description | |
| ) | |
| ); | |
| ?> | |
| </div> | |
| </li> | |
| <?php | |
| endfor; | |
| ?> | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment