HEX
Server: LiteSpeed
System: Linux standart103.isimtescil.net 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: byildiz (11197)
PHP: 8.2.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/byildiz.com.tr/httpdocs/wp-content/plugins/lumex-plugin/elementor/widgets/faq.php
<?php
namespace Elementor;

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/**
 * Lumex Faq Widget.
 *
 * @since 1.0
 */
class Lumex_Faq_Widget extends Widget_Base {

	public function get_name() {
		return 'lumex-faq';
	}

	public function get_title() {
		return esc_html__( 'Faq', 'lumex-plugin' );
	}

	public function get_icon() {
		return 'eicon-parallax';
	}

	public function get_categories() {
		return [ 'lumex-category' ];
	}

	/**
	 * Register widget controls.
	 *
	 * @since 1.0
	 */
	protected function register_controls() {

		$this->start_controls_section(
			'items_tab',
			[
				'label' => esc_html__( 'Items', 'lumex-plugin' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'title', [
				'label'       => esc_html__( 'Title', 'lumex-plugin' ),
				'type'        => Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Enter title', 'lumex-plugin' ),
				'default'	=> esc_html__( 'Title', 'lumex-plugin' ),
			]
		);

		$repeater->add_control(
			'text', [
				'label'       => esc_html__( 'Text', 'lumex-plugin' ),
				'type'        => Controls_Manager::WYSIWYG,
				'placeholder' => esc_html__( 'Enter text', 'lumex-plugin' ),
				'default'	=> esc_html__( 'Text', 'lumex-plugin' ),
			]
		);

		$this->add_control(
			'items',
			[
				'label' => esc_html__( 'Items', 'lumex-plugin' ),
				'type' => Controls_Manager::REPEATER,
				'prevent_empty' => false,
				'fields' => $repeater->get_controls(),
				'title_field' => '{{{ title }}}',
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'items_styling',
			[
				'label'     => esc_html__( 'Items Styles', 'lumex-plugin' ),
				'tab'       => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'item_title_color',
			[
				'label'     => esc_html__( 'Title Color', 'lumex-plugin' ),
				'type'      => Controls_Manager::COLOR,
				'default'	=> '',
				'selectors' => [
					'{{WRAPPER}} .mil-faq .mil-faq-item .mil-faq-question' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'item_title_typography',
				'label'     => esc_html__( 'Title Typography', 'lumex-plugin' ),
				'selector' => '{{WRAPPER}} .mil-faq .mil-faq-item .mil-faq-question',
			]
		);

		$this->add_control(
			'item_title_icon_color',
			[
				'label'     => esc_html__( 'Title Icon Color', 'lumex-plugin' ),
				'type'      => Controls_Manager::COLOR,
				'default'	=> '',
				'selectors' => [
					'{{WRAPPER}} .mil-faq .mil-faq-item .mil-faq-question .mil-faq-icon' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'item_desc_color',
			[
				'label'     => esc_html__( 'Description Color', 'lumex-plugin' ),
				'type'      => Controls_Manager::COLOR,
				'default'	=> '',
				'selectors' => [
					'{{WRAPPER}} .mil-faq .mil-faq-item .mil-faq-answer .mil-t-16' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'item_desc_typography',
				'label'     => esc_html__( 'Description Typography', 'lumex-plugin' ),
				'selector' => '{{WRAPPER}} .mil-faq .mil-faq-item .mil-faq-answer .mil-t-16',
			]
		);

		$this->add_control(
			'item_brcolor',
			[
				'label'     => esc_html__( 'Item Border Color', 'lumex-plugin' ),
				'type'      => Controls_Manager::COLOR,
				'default'	=> '',
				'selectors' => [
					'{{WRAPPER}} .mil-faq .mil-faq-item' => 'border-bottom-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_section();
	}


	/**
	 * Render widget output on the frontend.
	 *
	 * @since 1.0
	 */
	protected function render() {
		$settings = $this->get_settings_for_display();

		?>

		<div class="mil-faq">
			<?php if ( $settings['items'] ) : ?>
			<ul class="mil-faq-list">
				<?php foreach ( $settings['items'] as $index => $item ) :
					$item_title = $this->get_repeater_setting_key( 'title', 'items', $index );
					$this->add_inline_editing_attributes( $item_title, 'basic' );

					$item_text = $this->get_repeater_setting_key( 'text', 'items', $index );
					$this->add_inline_editing_attributes( $item_text, 'basic' );
				?>
				<li class="mil-faq-item">
					<?php if ( $item['title'] ) : ?>
					<button class="mil-faq-question">
						<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
							<?php echo wp_kses_post( $item['title'] ); ?>
						</span>
						<span class="mil-faq-icon">
							<i class="fa fa-arrow-right"></i>
						</span>
					</button>
					<?php endif; ?>
					<div class="mil-faq-answer">
						<?php if ( $item['text'] ) : ?>
						<div class="mil-t-16 mil-c-m-2">
							<div <?php echo $this->get_render_attribute_string( $item_text ); ?>>
								<?php echo wp_kses_post( $item['text'] ); ?>
							</div>
						</div>
						<?php endif; ?>
					</div>
				</li>
				<?php endforeach; ?>
			</ul>
			<?php endif; ?>
		</div>

		<?php
	}
}

Plugin::instance()->widgets_manager->register( new Lumex_Faq_Widget() );