Site icon Hip-Hop Website Design and Development

Registered customized dynamic tag not showing

I’m making an attempt so as to add/register a customized dynamic tag in Elementor. I exploit the very same code as from an instance the place it simply works, however some unusual cause the dynamic tag "ACF Average" doesn’t seem within the dropdown.

My code for registering the dynamic tag:

<?php
add_action( 'elementor/dynamic_tags/register_tags', operate( $dynamic_tags ) {
    class Custom_ACF_Avg_Tag extends ElementorCoreDynamicTagsTag {

        public operate get_name() {
            return 'Custom_ACF_Avg_Tag';
        }

        public operate get_categories() {
            return [ 'number' ];
        }

        public operate get_group() {
            return [ 'site' ];
        }

        public operate get_title() {
            return 'ACF Common';
        }

        protected operate _register_controls() {
            $this->add_control(
                'fields',
                [
                    'label' => __( 'Fields', 'text-domain' ),
                    'type' => 'text',
                ]
            );
        }

        public operate render() {
            $fields = $this->get_settings( 'fields' );
            $sum = 0;
            $depend = 0;
            $worth = 0;

            // Be sure that ACF if put in and activated
            if ( ! function_exists( 'get_field' ) ) {
                echo 0;
                return;
            }

            foreach ( explode( ',', $fields ) as $index => $field_name ) {
                $discipline = get_field( $field_name );
                if ( (int) $discipline > 0 ) {
                    $sum += (int) $discipline;
                    $depend++;
                }
            }

            if ( 0 !== $depend ) {
                $worth = $sum / $depend;
            }

            echo $worth;
        }
    }
    $dynamic_tags->register_tag( 'Custom_ACF_Avg_Tag' );
} ); ?>