getPreviewPost( $editorPostId );
$editorPostId = $previewPost->ID;
}
$this->render( $block, $content, $editorPostId );
}
protected function render( $block, $content, $editorPostId ) {
if( isset( $GLOBALS['acfg_loop_field_value'] )) {
$size = 'full';
print '
';
print wp_get_attachment_image( $GLOBALS['acfg_loop_field_value'], $size );
print '
';
return;
}
$data = $block['data'];
$fieldKey = get_field('meta_key');
$fieldPostId = get_field('post_id');
if( $fieldPostId == 'current' ) {
$fieldValue = get_field( $fieldKey, $editorPostId );
} else {
$fieldValue = get_field( $fieldKey, $fieldPostId );
}
$size = 'full'; // (thumbnail, medium, large, full or custom size)
if( $fieldValue ) {
print wp_get_attachment_image( $fieldValue, $size );
}
}
}