get_name();
$style_depends = Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' )
? parent::get_style_depends()
: [ 'elementor-icons-fa-solid', 'elementor-icons-fa-brands', 'elementor-icons-fa-regular' ];
$style_depends[] = 'widget-link-in-bio-base';
if ( 'link-in-bio' !== $widget_name ) {
$style_depends[] = "widget-{$widget_name}";
}
return $style_depends;
}
public static function get_configuration() {
return [
'content' => [
'identity_section' => [
'identity_image_style' => [
'default' => 'profile',
],
'has_heading_text' => false,
'has_profile_image_controls' => false,
],
'bio_section' => [
'title' => [
'default' => esc_html__( 'Kitchen Chronicles', 'elementor' ),
],
'description' => [
'default' => esc_html__( 'Join me on my journey to a healthier lifestyle', 'elementor' ),
],
'has_about_field' => false,
],
'icon_section' => [
'has_text' => false,
'platform' => [
'group-1' => [
Social_Network_Provider::EMAIL,
Social_Network_Provider::TELEPHONE,
Social_Network_Provider::MESSENGER,
Social_Network_Provider::WAZE,
Social_Network_Provider::WHATSAPP,
],
'limit' => 5,
],
'default' => [
[
'icon_platform' => Social_Network_Provider::FACEBOOK,
],
[
'icon_platform' => Social_Network_Provider::INSTAGRAM,
],
[
'icon_platform' => Social_Network_Provider::TIKTOK,
],
],
],
'cta_section' => [
'cta_max' => 0,
'cta_has_image' => false,
'cta_repeater_defaults' => [
[
'cta_link_text' => esc_html__( 'Get Healthy', 'elementor' ),
],
[
'cta_link_text' => esc_html__( 'Top 10 Recipes', 'elementor' ),
],
[
'cta_link_text' => esc_html__( 'Meal Prep', 'elementor' ),
],
[
'cta_link_text' => esc_html__( 'Healthy Living Resources', 'elementor' ),
],
],
],
'image_links_section' => false,
],
'style' => [
'identity_section' => [
'has_profile_image_shape' => true,
'profile_image_max' => 115,
'cover_image_max' => 1000,
],
'cta_section' => [
'has_dividers' => false,
'has_image_border' => false,
'has_link_type' => [
'default' => 'button',
],
'has_corners' => [
'default' => 'rounded',
'options' => [
'round' => esc_html__( 'Round', 'elementor' ),
'rounded' => esc_html__( 'Rounded', 'elementor' ),
'sharp' => esc_html__( 'Sharp', 'elementor' ),
],
],
'has_padding' => true,
'has_background_control' => true,
'has_cta_control_text' => false,
'has_border_control' => [
'prefix' => 'cta_links',
'show_border_args' => [
'condition' => [
'cta_links_type' => 'button',
],
],
'border_width_args' => [
'condition' => [
'cta_links_type' => 'button',
],
'selectors' => [
'{{WRAPPER}} .e-link-in-bio' => '--e-link-in-bio-ctas-border-width: {{SIZE}}{{UNIT}}',
],
],
'border_color_args' => [
'condition' => [
'cta_links_type' => 'button',
],
'selectors' => [
'{{WRAPPER}} .e-link-in-bio' => '--e-link-in-bio-ctas-border-color: {{VALUE}}',
],
],
],
],
'border_section' => [
'field_options' => false,
'overlay_field_options' => false,
],
'image_links_section' => false,
],
];
}
public function get_description_position() {
return 'top';
}
public function get_icon(): string {
return 'eicon-site-identity';
}
public function get_categories(): array {
return [ 'link-in-bio' ];
}
public function get_keywords(): array {
return [ 'buttons', 'bio', 'widget', 'link in bio' ];
}
public function get_image_position_options(): array {
return [
'' => esc_html__( 'Default', 'elementor' ),
'center center' => esc_html__( 'Center Center', 'elementor' ),
'center left' => esc_html__( 'Center Left', 'elementor' ),
'center right' => esc_html__( 'Center Right', 'elementor' ),
'top center' => esc_html__( 'Top Center', 'elementor' ),
'top left' => esc_html__( 'Top Left', 'elementor' ),
'top right' => esc_html__( 'Top Right', 'elementor' ),
'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
];
}
protected function register_controls(): void {
$this->add_content_tab();
$this->add_style_tab();
}
protected function render(): void {
$render_strategy = new Core_Render( $this );
$render_strategy->render();
}
protected function add_image_links_controls() {
$config = static::get_configuration();
if ( empty( $config['content']['image_links_section'] ) ) {
return;
}
$this->start_controls_section(
'image_links_section',
[
'label' => esc_html__( 'Image Links', 'elementor' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
if ( ! empty( $config['content']['image_links_section']['images_max'] ) ) {
$this->add_control(
'image_links_alert',
[
'type' => Controls_Manager::ALERT,
'alert_type' => 'info',
'content' => sprintf(
__( 'Add up to %d Images', 'elementor' ),
$config['content']['image_links_section']['images_max']
),
]
);
}
$this->add_icons_per_row_control(
'image_links_per_row',
[
'1' => '1',
'2' => '2',
'3' => '3',
],
'2',
esc_html__( 'Images Per Row', 'elementor' ),
'--e-link-in-bio-image-links-columns',
);
$repeater = new Repeater();
$repeater->add_control(
'image_links_image',
[
'label' => esc_html__( 'Choose Image', 'elementor' ),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'image_links_url',
[
'label' => esc_html__( 'Link', 'elementor' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'autocomplete' => true,
'label_block' => true,
'placeholder' => esc_html__( 'Paste URL or type', 'elementor' ),
'default' => [
'is_external' => true,
],
],
);
$this->add_control(
'image_links',
[
'type' => Controls_Manager::REPEATER,
'max_items' => $config['content']['image_links_section']['images_max'] ?? 0,
'fields' => $repeater->get_controls(),
'prevent_empty' => true,
'button_text' => esc_html__( 'Add item', 'elementor' ),
'default' => $config['content']['image_links_section']['images_repeater_defaults'] ?? [],
]
);
$this->end_controls_section();
}
protected function add_cta_controls() {
$config = static::get_configuration();
if ( empty( $config['content']['cta_section'] ) ) {
return;
}
$this->start_controls_section(
'cta_section',
[
'label' => esc_html__( 'CTA Link Buttons', 'elementor' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
if ( ! empty( $config['content']['cta_section']['cta_max'] ) ) {
$this->add_control(
'cta_section_alert',
[
'type' => Controls_Manager::ALERT,
'alert_type' => 'info',
'content' => sprintf(
__( 'Add up to %d CTA links', 'elementor' ),
$config['content']['cta_section']['cta_max']
),
]
);
}
$repeater = new Repeater();
$repeater->add_control(
'cta_link_text',
[
'label' => esc_html__( 'Text', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'default' => esc_html__( 'CTA link', 'elementor' ),
'placeholder' => esc_html__( 'Enter link text', 'elementor' ),
],
);
if ( $config['content']['cta_section']['cta_has_image'] ) {
$repeater->add_control(
'cta_link_image',
[
'label' => esc_html__( 'Choose Image', 'elementor' ),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
}
$repeater->add_control(
'cta_link_type',
[
'label' => esc_html__( 'Link Type', 'elementor' ),
'type' => Controls_Manager::SELECT,
'groups' => [
[
'label' => '',
'options' => Social_Network_Provider::get_social_networks_text(
[
Social_Network_Provider::URL,
Social_Network_Provider::FILE_DOWNLOAD,
]
),
],
[
'label' => ' --',
'options' => Social_Network_Provider::get_social_networks_text(
[
Social_Network_Provider::EMAIL,
Social_Network_Provider::TELEPHONE,
Social_Network_Provider::MESSENGER,
Social_Network_Provider::WAZE,
Social_Network_Provider::WHATSAPP,
]
),
],
],
'default' => Social_Network_Provider::URL,
],
);
$repeater->add_control(
'cta_link_file',
[
'label' => esc_html__( 'Choose File', 'elementor' ),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
'media_type' => [ 'application/pdf' ],
'condition' => [
'cta_link_type' => [
Social_Network_Provider::FILE_DOWNLOAD,
],
],
'ai' => [
'active' => false,
],
],
);
$repeater->add_control(
'cta_link_url',
[
'label' => esc_html__( 'Link', 'elementor' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'autocomplete' => true,
'label_block' => true,
'condition' => [
'cta_link_type' => [
Social_Network_Provider::URL,
],
],
'placeholder' => esc_html__( 'Enter your link', 'elementor' ),
'default' => [
'is_external' => true,
],
],
);
$repeater->add_control(
'cta_link_mail',
[
'label' => esc_html__( 'Mail', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'condition' => [
'cta_link_type' => [
Social_Network_Provider::EMAIL,
],
],
'placeholder' => esc_html__( 'Enter your email', 'elementor' ),
],
);
$repeater->add_control(
'cta_link_mail_subject',
[
'label' => esc_html__( 'Subject', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'condition' => [
'cta_link_type' => [
Social_Network_Provider::EMAIL,
],
],
'placeholder' => esc_html__( 'Subject', 'elementor' ),
],
);
$repeater->add_control(
'cta_link_mail_body',
[
'label' => esc_html__( 'Message', 'elementor' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'condition' => [
'cta_link_type' => [
Social_Network_Provider::EMAIL,
],
],
'placeholder' => esc_html__( 'Message', 'elementor' ),
],
);
$repeater->add_control(
'cta_link_number',
[
'label' => esc_html__( 'Number', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'condition' => [
'cta_link_type' => [
Social_Network_Provider::TELEPHONE,
Social_Network_Provider::WHATSAPP,
],
],
'placeholder' => esc_html__( 'Enter your number', 'elementor' ),
],
);
$repeater->add_control(
'cta_link_location',
[
'label' => esc_html__( 'Location', 'elementor' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'default' => [
'is_external' => true,
],
'label_block' => true,
'condition' => [
'cta_link_type' => [
Social_Network_Provider::WAZE,
],
],
'placeholder' => esc_html__( 'Paste Waze link', 'elementor' ),
],
);
$repeater->add_control(
'cta_link_username',
[
'label' => esc_html__( 'Username', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'condition' => [
'cta_link_type' => [
Social_Network_Provider::MESSENGER,
],
],
'placeholder' => esc_html__( 'Enter your username', 'elementor' ),
],
);
$this->add_control(
'cta_link',
[
'type' => Controls_Manager::REPEATER,
'max_items' => $config['content']['cta_section']['cta_max'] ?? 0,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ cta_link_text }}}',
'button_text' => esc_html__( 'Add CTA Link', 'elementor' ),
'default' => $config['content']['cta_section']['cta_repeater_defaults'],
]
);
$this->end_controls_section();
}
protected function add_icons_controls(): void {
$config = static::get_configuration();
$this->start_controls_section(
'icons_section',
[
'label' => esc_html__( 'Icons', 'elementor' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
if ( $config['content']['icon_section']['platform']['limit'] ) {
$this->add_control(
'custom_panel_alert',
[
'type' => Controls_Manager::ALERT,
'alert_type' => 'info',
'content' => sprintf(
__( 'Add up to %d icons', 'elementor' ),
$config['content']['icon_section']['platform']['limit']
),
]
);
}
$repeater = new Repeater();
if ( $config['content']['icon_section']['has_text'] ) {
$repeater->add_control(
'icon_text',
[
'label' => esc_html__( 'Text', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__( 'Enter icon text', 'elementor' ),
],
);
}
$repeater->add_control(
'icon_platform',
[
'label' => esc_html__( 'Platform', 'elementor' ),
'type' => Controls_Manager::SELECT,
'groups' => [
[
'label' => '',
'options' => Social_Network_Provider::get_social_networks_text(
$config['content']['icon_section']['platform']['group-1']
),
],
[
'label' => ' --',
'options' => Social_Network_Provider::get_social_networks_text(
[
Social_Network_Provider::FACEBOOK,
Social_Network_Provider::INSTAGRAM,
Social_Network_Provider::LINKEDIN,
Social_Network_Provider::PINTEREST,
Social_Network_Provider::TIKTOK,
Social_Network_Provider::TWITTER,
Social_Network_Provider::YOUTUBE,
]
),
],
[
'label' => ' --',
'options' => Social_Network_Provider::get_social_networks_text(
[
Social_Network_Provider::APPLEMUSIC,
Social_Network_Provider::BEHANCE,
Social_Network_Provider::DRIBBBLE,
Social_Network_Provider::SPOTIFY,
Social_Network_Provider::SOUNDCLOUD,
Social_Network_Provider::VIMEO,
]
),
],
],
'default' => Social_Network_Provider::FACEBOOK,
],
);
$repeater->add_control(
'icon_url',
[
'label' => esc_html__( 'Link', 'elementor' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'autocomplete' => true,
'label_block' => true,
'placeholder' => esc_html__( 'Enter your link', 'elementor' ),
'default' => [
'is_external' => true,
],
'condition' => [
'icon_platform' => [
Social_Network_Provider::VIMEO,
Social_Network_Provider::FACEBOOK,
Social_Network_Provider::SOUNDCLOUD,
Social_Network_Provider::SPOTIFY,
Social_Network_Provider::INSTAGRAM,
Social_Network_Provider::LINKEDIN,
Social_Network_Provider::PINTEREST,
Social_Network_Provider::TIKTOK,
Social_Network_Provider::TWITTER,
Social_Network_Provider::YOUTUBE,
Social_Network_Provider::APPLEMUSIC,
Social_Network_Provider::BEHANCE,
Social_Network_Provider::DRIBBBLE,
Social_Network_Provider::SPOTIFY,
Social_Network_Provider::SOUNDCLOUD,
Social_Network_Provider::URL,
],
],
],
);
$repeater->add_control(
'icon_mail',
[
'label' => esc_html__( 'Email', 'elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter your email', 'elementor' ),
'dynamic' => [
'active' => true,
],
'label_block' => true,
'condition' => [
'icon_platform' => [
Social_Network_Provider::EMAIL,
],
],
'ai' => [
'active' => false,
],
]
);
$repeater->add_control(
'icon_mail_subject',
[
'label' => esc_html__( 'Subject', 'elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Subject', 'elementor' ),
'label_block' => true,
'condition' => [
'icon_platform' => [
Social_Network_Provider::EMAIL,
],
],
]
);
$repeater->add_control(
'icon_mail_body',
[
'label' => esc_html__( 'Message', 'elementor' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Message', 'elementor' ),
'label_block' => true,
'condition' => [
'icon_platform' => [
Social_Network_Provider::EMAIL,
],
],
]
);
$repeater->add_control(
'icon_number',
[
'label' => esc_html__( 'Number', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'placeholder' => esc_html__( '+', 'elementor' ),
'condition' => [
'icon_platform' => [
Social_Network_Provider::TELEPHONE,
Social_Network_Provider::WHATSAPP,
],
],
'ai' => [
'active' => false,
],
],
);
$repeater->add_control(
'icon_location',
[
'label' => esc_html__( 'Location', 'elementor' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'default' => [
'is_external' => true,
],
'label_block' => true,
'placeholder' => esc_html__( 'Paste Waze link', 'elementor' ),
'condition' => [
'icon_platform' => [
Social_Network_Provider::WAZE,
],
],
'ai' => [
'active' => false,
],
],
);
$repeater->add_control(
'icon_username',
[
'label' => esc_html__( 'Username', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'placeholder' => esc_html__( 'Enter your username', 'elementor' ),
'condition' => [
'icon_platform' => [
Social_Network_Provider::MESSENGER,
],
],
],
);
$this->add_control(
'icon',
[
'max_items' => $config['content']['icon_section']['platform']['limit'],
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'title_field' => $this->get_icon_title_field(),
'prevent_empty' => true,
'button_text' => esc_html__( 'Add Icon', 'elementor' ),
'default' => $config['content']['icon_section']['default'],
]
);
$this->end_controls_section();
}
protected function get_icon_title_field(): string {
$platform_icons_js = json_encode( Social_Network_Provider::get_social_networks_icons() );
return <<