<?php

/*
 * This file is part of the Fancy Bricks package.
 *
 * (c) Joshua Gugun Siagian <suabahasa@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
declare (strict_types=1);
namespace Fancy\Animations\Bricks\Elements;

use Bricks\Element_Block;
/**
 * Bricks Builder' integration
 */
class ToggleAnimationsElement extends Element_Block
{
    // Element properties
    public $category = 'general';
    public $name = 'fba-toggle-animations';
    public $icon = 'fas fa-toggle-on';
    public $css_selector = '';
    public $scripts = [];
    public $nestable = \true;
    // true || @since 1.5
    public function get_label()
    {
        return \__('Toggle Animations', 'fancy-animations');
    }
    public function get_keywords()
    {
        return ['toggle', 'animations', 'fancy animations'];
    }
    public function set_controls()
    {
        parent::set_controls();
        $this->controls['reloadPageCheckbox'] = ['label' => \esc_html__('Reload Page', 'fancy-animations'), 'type' => 'checkbox', 'inline' => \true, 'small' => \true, 'default' => \true, 'description' => \esc_html__('Reload page after toggle animations', 'fancy-animations')];
        $this->controls['ariaLabelText'] = [
            'tab' => 'content',
            'label' => \esc_html__('Aria Label', 'fancy-animations'),
            'type' => 'text',
            'spellcheck' => \true,
            // Default: false
            'inlineEditing' => \true,
            'default' => 'Enable the animations',
            'inline' => \true,
        ];
        $this->controls['_cssGlobalClasses']['default'] = ['fb-disable-animations'];
    }
    public function get_nestable_children()
    {
        return [['name' => 'block', 'label' => \__('Button animations', 'fancy-animations'), 'settings' => ['tag' => 'custom', 'customTag' => 'button', '_cssGlobalClasses' => ['fb-disable-animations__btn'], '_attributes' => [['name' => 'Role', 'value' => 'switch'], ['name' => 'aria-checked', 'value' => 'true']]], 'children' => [['name' => 'icon', 'settings' => ['icon' => ['library' => 'fontawesomeSolid', 'icon' => 'fas fa-circle-check'], '_cssGlobalClasses' => ['fb-disable-animations__icon']]]]], ['name' => 'text-basic', 'label' => \__('Tooltip', 'fancy-animations'), 'settings' => ['text' => 'Animations', '_attributes' => [['name' => 'role', 'value' => 'tooltip']], '_cssGlobalClasses' => ['fb-disable-animations__tooltip']]]];
    }
    public function render()
    {
        $this->set_attribute('_root', 'role', 'group');
        $this->set_attribute('_root', 'data-fba-reload-page', isset($this->settings['reloadPageCheckbox']) ? 1 : 0);
        $this->set_attribute('_root', 'data-fba-aria-label', $this->settings['ariaLabelText']);
        parent::render();
    }
}
