PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.2
Elementor Website Builder – more than just a page builder v3.19.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / template-library / forms / new-template-form.php

new-template-form.php in Elementor Website Builder – more than just a page builder 3.19.2, at includes/template-library/forms/new-template-form.php

53 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\TemplateLibrary\Forms;
3
4 use Elementor\Controls_Manager;
5 use Elementor\Controls_Stack;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly
9 }
10
11 class New_Template_Form extends Controls_Stack {
12
13 public function get_name() {
14 return 'add-template-form';
15 }
16
17 /**
18 * @throws \Exception
19 */
20 public function render() {
21 foreach ( $this->get_controls() as $control ) {
22 switch ( $control['type'] ) {
23 case Controls_Manager::SELECT:
24 $this->render_select( $control );
25 break;
26 default:
27 throw new \Exception( "'{$control['type']}' control type is not supported." );
28 }
29 }
30 }
31
32 private function render_select( $control_settings ) {
33 $control_id = "elementor-new-template__form__{$control_settings['name']}";
34 $wrapper_class = isset( $control_settings['wrapper_class'] ) ? $control_settings['wrapper_class'] : '';
35 ?>
36 <div id="<?php echo esc_attr( $control_id ); ?>__wrapper" class="elementor-form-field <?php echo esc_attr( $wrapper_class ); ?>">
37 <label for="<?php echo esc_attr( $control_id ); ?>" class="elementor-form-field__label">
38 <?php echo esc_html( $control_settings['label'] ); ?>
39 </label>
40 <div class="elementor-form-field__select__wrapper">
41 <select id="<?php echo esc_attr( $control_id ); ?>" class="elementor-form-field__select" name="meta[<?php echo esc_html( $control_settings['name'] ); ?>]">
42 <?php
43 foreach ( $control_settings['options'] as $key => $value ) {
44 echo sprintf( '<option value="%1$s">%2$s</option>', esc_html( $key ), esc_html( $value ) );
45 }
46 ?>
47 </select>
48 </div>
49 </div>
50 <?php
51 }
52 }
53