| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Components\Documents; |
| 3 |
|
| 4 |
use Elementor\Core\Base\Document; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
class Component extends Document { |
| 11 |
const TYPE = 'elementor_component'; |
| 12 |
const COMPONENT_UID_META_KEY = '_elementor_component_uid'; |
| 13 |
const OVERRIDABLE_PROPS_META_KEY = '_elementor_component_overridable_props'; |
| 14 |
|
| 15 |
public static function get_properties() { |
| 16 |
$properties = parent::get_properties(); |
| 17 |
|
| 18 |
$properties['cpt'] = [ self::TYPE ]; |
| 19 |
|
| 20 |
return $properties; |
| 21 |
} |
| 22 |
|
| 23 |
public static function get_type() { |
| 24 |
return self::TYPE; |
| 25 |
} |
| 26 |
|
| 27 |
public static function get_title() { |
| 28 |
return esc_html__( 'Component', 'elementor' ); |
| 29 |
} |
| 30 |
|
| 31 |
public static function get_plural_title() { |
| 32 |
return esc_html__( 'Components', 'elementor' ); |
| 33 |
} |
| 34 |
|
| 35 |
public static function get_labels(): array { |
| 36 |
$plural_label = static::get_plural_title(); |
| 37 |
$singular_label = static::get_title(); |
| 38 |
|
| 39 |
$labels = [ |
| 40 |
'name' => $plural_label, |
| 41 |
'singular_name' => $singular_label, |
| 42 |
]; |
| 43 |
|
| 44 |
return $labels; |
| 45 |
} |
| 46 |
|
| 47 |
public static function get_supported_features(): array { |
| 48 |
return [ |
| 49 |
'title', |
| 50 |
'author', |
| 51 |
'thumbnail', |
| 52 |
'custom-fields', |
| 53 |
'revisions', |
| 54 |
'elementor', |
| 55 |
]; |
| 56 |
} |
| 57 |
|
| 58 |
public function get_component_uid() { |
| 59 |
return $this->get_meta( self::COMPONENT_UID_META_KEY ); |
| 60 |
} |
| 61 |
|
| 62 |
public function get_overridable_props(): Component_Overridable_Props { |
| 63 |
$meta = $this->get_meta( self::OVERRIDABLE_PROPS_META_KEY ); |
| 64 |
|
| 65 |
return new Component_Overridable_Props( $meta ); |
| 66 |
} |
| 67 |
} |
| 68 |
|