| 1 |
<?php |
| 2 |
|
| 3 |
$prefix = 'b-blocks-one-page-navigation'; |
| 4 |
$id = wp_unique_id( 'bBlocksOnePageNavigation-' ); |
| 5 |
|
| 6 |
$planClass = BBlocks\Inc\Utils::isPro() ? 'pro' : 'free'; |
| 7 |
|
| 8 |
$layout = isset( $attributes['layout'] ) && is_array( $attributes['layout'] ) ? $attributes['layout'] : []; |
| 9 |
$desktop = isset( $layout['desktop'] ) && is_array( $layout['desktop'] ) ? $layout['desktop'] : []; |
| 10 |
$posValue = '' !== ( $desktop['position'] ?? '' ) ? $desktop['position'] : ( $layout['position'] ?? '' ); |
| 11 |
$vertValue = '' !== ( $desktop['verticalAlign'] ?? '' ) ? $desktop['verticalAlign'] : ( $layout['verticalAlign'] ?? '' ); |
| 12 |
$position = in_array( $posValue, [ 'left', 'right' ], true ) ? $posValue : 'right'; |
| 13 |
$vertical = in_array( $vertValue, [ 'top', 'center', 'bottom' ], true ) ? $vertValue : 'center'; |
| 14 |
$wrapClass = "$planClass $prefix-pos-$position $prefix-align-$vertical"; |
| 15 |
|
| 16 |
?> |
| 17 |
<div |
| 18 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- get_block_wrapper_attributes() is properly escaped ?> |
| 19 |
<?php echo get_block_wrapper_attributes([ 'class' => $wrapClass ]); ?> |
| 20 |
id='<?php echo esc_attr( $id ); ?>' |
| 21 |
data-attributes='<?php echo esc_attr( wp_json_encode( $attributes ) ); ?>' |
| 22 |
></div> |