<?php
namespace Softech_Addons_for_Elementor\Includes\Dynamic_Tags\Tags\Post_Tags;

use Elementor\Core\DynamicTags\Tag;
use Elementor\Modules\DynamicTags\Module;
use Softech_Addons_for_Elementor\Includes\Dynamic_Tags\Groups\Softech_Post_Group;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

class Softech_Post_Url extends Tag {

    public function get_name() {
        return 'softech-post-url';
    }

    public function get_title() {
        return esc_html__( 'Post URL', 'softech-addons-for-elementor' );
    }

    public function get_group() {
        return Softech_Post_Group::get_name();
    }

    public function get_categories() {
        return [ Module::URL_CATEGORY ];
    }

    public function render() {
        $post_id = get_the_ID();

        if ( $post_id ) {
            echo esc_url( get_permalink( $post_id ) );
        }
    }
}
