PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.6
Elementor Website Builder – more than just a page builder v3.0.6
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / core / kits / documents / tabs / settings-site-identity.php

settings-site-identity.php in Elementor Website Builder – more than just a page builder 3.0.6, at core/kits/documents/tabs/settings-site-identity.php

109 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Core\Kits\Documents\Tabs;
4
5 use Elementor\Controls_Manager;
6 use Elementor\DB;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly
10 }
11
12 class Settings_Site_Identity extends Tab_Base {
13
14 public function get_id() {
15 return 'settings-site-identity';
16 }
17
18 public function get_title() {
19 return __( 'Site Identity', 'elementor' );
20 }
21
22 protected function register_tab_controls() {
23 $custom_logo_id = get_theme_mod( 'custom_logo' );
24 $custom_logo_src = wp_get_attachment_image_src( $custom_logo_id, 'full' );
25
26 $this->start_controls_section(
27 'section_' . $this->get_id(),
28 [
29 'label' => $this->get_title(),
30 'tab' => $this->get_id(),
31 ]
32 );
33
34 $this->add_control(
35 $this->get_id() . '_refresh_notice',
36 [
37 'type' => Controls_Manager::RAW_HTML,
38 'raw' => __( 'Changes will be reflected in the preview only after the page reloads.', 'elementor' ),
39 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
40 ]
41 );
42
43 $this->add_control(
44 'site_name',
45 [
46 'label' => __( 'Site Name', 'elementor' ),
47 'default' => get_option( 'blogname' ),
48 'placeholder' => __( 'Choose name', 'elementor' ),
49 'label_block' => true,
50 ]
51 );
52
53 $this->add_control(
54 'site_description',
55 [
56 'label' => __( 'Site Description', 'elementor' ),
57 'default' => get_option( 'blogdescription' ),
58 'placeholder' => __( 'Choose description', 'elementor' ),
59 'label_block' => true,
60 ]
61 );
62
63 $this->add_control(
64 'site_logo',
65 [
66 'label' => __( 'Site Logo', 'elementor' ),
67 'type' => Controls_Manager::MEDIA,
68 'default' => [
69 'id' => $custom_logo_id,
70 'url' => $custom_logo_src ? $custom_logo_src[0] : '',
71 ],
72 'description' => __( 'Suggested image dimensions: 350 × 100 pixels.', 'elementor' ),
73 ]
74 );
75
76 $this->add_control(
77 'site_favicon',
78 [
79 'label' => __( 'Site Favicon', 'elementor' ),
80 'type' => Controls_Manager::MEDIA,
81 'description' => __( 'Suggested favicon dimensions: 512 × 512 pixels.', 'elementor' ),
82 ]
83 );
84
85 $this->end_controls_section();
86 }
87
88 public function on_save( $data ) {
89 if ( ! isset( $data['settings'] ) || DB::STATUS_PUBLISH !== $data['settings']['post_status'] ) {
90 return;
91 }
92 if ( isset( $data['settings']['site_name'] ) ) {
93 update_option( 'blogname', $data['settings']['site_name'] );
94 }
95
96 if ( isset( $data['settings']['site_description'] ) ) {
97 update_option( 'blogdescription', $data['settings']['site_description'] );
98 }
99
100 if ( isset( $data['settings']['site_logo'] ) ) {
101 set_theme_mod( 'custom_logo', $data['settings']['site_logo']['id'] );
102 }
103
104 if ( isset( $data['settings']['site_favicon'] ) ) {
105 update_option( 'site_icon', $data['settings']['site_favicon']['id'] );
106 }
107 }
108 }
109