Okay
  Public Ticket #2780325
Elementor Sonaar Addons plugin
Closed

Comments

  • Luigi started the conversation

    Hello there, a fellow developer here.

    While assisting a customer who is using your Sonaar theme, I noticed that the Elementor Widgets created by my plugin are not showing up in the list of the available widgets in the Elementor Editor. Since the issue gets solved when deactivating your Elementor Sonar Addons plugin, I further investigated the problem and, after carefully analyzing the code of your "Elementor Sonaar Addons" plugins, I tracked down the issue on line 199 of the file elementor-for-sonaar.php. It appears that the registration of your widgets is not compliant with the Elementor Developers Guidelines.

    Your widget class files contain a call to the register_widget_type method directly right at the end of each file, after each widget class definition. By doing so, you end up registering your custom widgets during the default WordPress init action (this is where you include all your widget class files), instead of during the elementor/widgets/widgets_registered action, as it is specified on THIS PAGE of the Elementor Developers Documentation.

    Changing line 199 from this:

    add_action( 'init', [ $this, 'sr_init_extensions' ] )
    

    to this:

    add_action( 'elementor/widgets/widgets_registered', [ $this, 'sr_init_extensions' ] );
    

    permanently solves the problem.

    While this is a simple fix and seems to work, you might want to consider refactoring the elementor-for-sonaar.php file so that the inclusion of the class files occur during the init action, while the calls to the register_widget_type methods occur during the elementor/widgets/widgets_registered action, as per the Elementor documentation.

    I hope this is useful.

  •  529
    Max replied

    Hi Luigi,

    Thanks for reporting this. You are correct and we will fix it in our next plugin update.

    best regards,

    Thanks,


    Max from the Sonaar.io Crew

  • Luigi replied

    Hi, Max,

    Thanks for your prompt reply and your commitment to fixing the issue on the next update.
    I am glad I was able to help.

    Best,
    Luigi.

  •  529
    Max replied

    Hi there,

    We have noticed that by doing this, it does not load our sticky section in the advanced tab of Elementor when not using Elementor Pro (this happen only with Elementor free edition) (see screenshot: https://d.pr/i/bBj2st )

    We will have to wait before pushing this commit as it needs more testing. We are currently on a pretty tight schedule right now, so we won't have time during the next week to test this as we would like.

    Feel free to share any discoveries you make and I will check this with you.


    Thanks,


    Max from the Sonaar.io Crew

  • Luigi replied

    Hi, Max,

    I would love to further investigate the issue for you because the current approach affects the way my own plugin is displayed in the list of the available Elementor widgets. Unfortunately, I don't own your theme or plugin myself. So, I can only rely on the backend of my customer who has Elementor Pro.

    I will see if my customer is available to let me experiment with this issue, by temporarily deactivating Elementor Pro, and I will let you know what I find. Alternatively, if you have a development copy of your plugin that you would like me to test on my own environment, you can write to me at support@waveplayer.info.

    Thanks for your support.
    Luigi