start_controls_section( 'akla_content', array( 'label' => __( 'Configuration', 'actikidz-local-activities' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $options = AKLA_Elementor::profile_options(); $this->add_control( 'profile', array( 'label' => __( 'Configuration', 'actikidz-local-activities' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => $options, 'default' => '', 'description' => count( $options ) > 1 ? '' : __( 'No saved configurations yet. Connect the service and save a configuration in settings.', 'actikidz-local-activities' ), ) ); $this->end_controls_section(); $this->start_controls_section( 'akla_display', array( 'label' => __( 'Display', 'actikidz-local-activities' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'limit', array( 'label' => __( 'Number of activities', 'actikidz-local-activities' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 1, 'max' => 12, 'step' => 1, 'default' => '', 'description' => __( 'Leave empty to use the configuration setting (1–12).', 'actikidz-local-activities' ), ) ); $this->add_control( 'layout', array( 'label' => __( 'Layout', 'actikidz-local-activities' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => array( '' => __( 'Use configuration setting', 'actikidz-local-activities' ), 'cards' => __( 'Cards', 'actikidz-local-activities' ), 'list' => __( 'List', 'actikidz-local-activities' ), ), 'default' => '', ) ); $levels = array(); foreach ( range( 2, 6 ) as $level ) { /* translators: %d: HTML heading level, 2 to 6. */ $levels[ (string) $level ] = sprintf( __( 'Heading %d', 'actikidz-local-activities' ), $level ); } $this->add_control( 'heading_level', array( 'label' => __( 'Heading level', 'actikidz-local-activities' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => $levels, 'default' => '3', ) ); $this->add_control( 'compact', array( 'label' => __( 'Compact', 'actikidz-local-activities' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => '', ) ); $this->end_controls_section(); } /** * Render through the shared renderer. * * @return void */ protected function render() { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- AKLA_Renderer escapes every value it outputs and the editor hint is esc_html()'d; the shortcode and block return this same markup unfiltered. echo AKLA_Elementor::render_widget( $this->get_settings_for_display(), $this->get_id() ); } }