| @@ -1,5 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit; | |
| 5 | +} | |
| 2 | 6 | /** |
| 3 | 7 | * Template for BetterDocs Code Snippet Widget |
| 4 | 8 | * |
| 5 | 9 | * @var string $code_content |
| @@ -13,13 +17,20 @@ | ||
| 13 | 17 | if ( empty( $code_content ) ) { |
| 14 | 18 | return; |
| 15 | 19 | } |
| 16 | 20 | |
| 17 | -// Use the template part for consistent rendering | |
| 21 | +// Use the template part for consistent rendering (block + Elementor share it). | |
| 18 | 22 | $view_object->get( 'templates/parts/code-snippet', [ |
| 19 | - 'code_content' => $code_content, | |
| 20 | - 'language' => $language, | |
| 21 | - 'show_copy_button' => $show_copy_button, | |
| 22 | - 'show_line_numbers' => $show_line_numbers, | |
| 23 | - 'theme' => $theme, | |
| 24 | - 'widget_type' => $widget_type, | |
| 23 | + 'code_content' => $code_content, | |
| 24 | + 'language' => $language, | |
| 25 | + 'code_variants' => isset( $code_variants ) ? $code_variants : [], | |
| 26 | + 'show_copy_button' => $show_copy_button, | |
| 27 | + 'show_header' => isset( $show_header ) ? $show_header : true, | |
| 28 | + 'show_line_numbers' => $show_line_numbers, | |
| 29 | + 'show_language_label' => isset( $show_language_label ) ? $show_language_label : true, | |
| 30 | + 'theme' => $theme, | |
| 31 | + 'widget_type' => $widget_type, | |
| 32 | + 'file_name' => isset( $file_name ) ? $file_name : '', | |
| 33 | + 'show_traffic_lights' => isset( $show_traffic_lights ) ? $show_traffic_lights : true, | |
| 34 | + 'show_file_icon' => isset( $show_file_icon ) ? $show_file_icon : true, | |
| 35 | + 'file_icon' => isset( $file_icon ) ? $file_icon : '', | |
| 25 | 36 | ] ); |