first commit

This commit is contained in:
Roman Pyrih
2025-07-11 12:34:24 +02:00
commit 296b13244b
10181 changed files with 3916595 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls;
use JsonSerializable;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Section implements JsonSerializable {
private ?string $id = null;
private $label = null;
private $description = null;
private array $items = [];
public static function make(): self {
return new static();
}
public function set_id( string $id ): self {
$this->id = $id;
return $this;
}
public function get_id() {
return $this->id;
}
public function set_label( string $label ): self {
$this->label = $label;
return $this;
}
public function set_description( string $description ): self {
$this->description = $description;
return $this;
}
public function set_items( array $items ): self {
$this->items = $items;
return $this;
}
public function add_item( $item ): self {
$this->items[] = $item;
return $this;
}
public function get_items() {
return $this->items;
}
public function jsonSerialize(): array {
return [
'type' => 'section',
'value' => [
'label' => $this->label,
'description' => $this->description,
'items' => $this->items,
],
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Base\Atomic_Control_Base;
use Elementor\Modules\AtomicWidgets\Image\Image_Sizes;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Image_Control extends Atomic_Control_Base {
private string $show_mode = 'all';
public function set_show_mode( string $show_mode ): self {
$this->show_mode = $show_mode;
return $this;
}
public function get_type(): string {
return 'image';
}
public function get_props(): array {
return [
'sizes' => Image_Sizes::get_all(),
'showMode' => $this->show_mode,
];
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Base\Atomic_Control_Base;
use Elementor\Modules\WpRest\Classes\Post_Query;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Link_Control extends Atomic_Control_Base {
private bool $allow_custom_values = true;
private int $minimum_input_length = 2;
private ?string $placeholder = null;
private array $query_options = [
'endpoint' => '',
'requestParams' => [],
];
public static function bind_to( string $prop_name ) {
$instance = parent::bind_to( $prop_name );
$instance->set_placeholder( __( 'Type or paste your URL', 'elementor' ) );
$instance->set_endpoint( Post_Query::NAMESPACE . '/' . Post_Query::ENDPOINT );
$instance->set_request_params( Post_Query::build_query_params( [
Post_Query::POST_KEYS_CONVERSION_MAP => [
'ID' => 'id',
'post_title' => 'label',
'post_type' => 'groupLabel',
],
] ) );
return $instance;
}
public function get_type(): string {
return 'link';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
'allowCustomValues' => $this->allow_custom_values,
'queryOptions' => $this->query_options,
'minInputLength' => $this->minimum_input_length,
];
}
public function set_allow_custom_values( bool $allow_custom_values ): self {
$this->allow_custom_values = $allow_custom_values;
return $this;
}
public function set_endpoint( string $url ): self {
$this->query_options['endpoint'] = $url;
return $this;
}
public function set_request_params( array $params ): self {
$this->query_options['requestParams'] = $params;
return $this;
}
public function set_minimum_input_length( int $input_length ): self {
$this->minimum_input_length = $input_length;
return $this;
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Select_Control extends Atomic_Control_Base {
private array $options = [];
public function get_type(): string {
return 'select';
}
public function set_options( array $options ): self {
$this->options = $options;
return $this;
}
public function get_props(): array {
return [
'options' => $this->options,
];
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Base\Atomic_Control_Base;
use Elementor\Modules\AtomicWidgets\Image_Sizes;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Svg_Control extends Atomic_Control_Base {
public function get_type(): string {
return 'svg-media';
}
public function get_props(): array {
return [
'type' => $this->get_type(),
];
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Switch_Control extends Atomic_Control_Base {
public function get_type(): string {
return 'switch';
}
public function get_props(): array {
return [];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Text_Control extends Atomic_Control_Base {
private ?string $placeholder = null;
public function get_type(): string {
return 'text';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Textarea_Control extends Atomic_Control_Base {
private $placeholder = null;
public function get_type(): string {
return 'textarea';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
];
}
}