# master-addons/3.1.9/inc/modules/display/image-masking/image-masking.php

Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder &amp; Template Kits, version 3.1.9. 100 lines.

- Page: https://pluginprobe.com/plugins/master-addons/3.1.9/code/inc/modules/display/image-masking/image-masking.php
- Raw: https://pluginprobe.com/plugins/master-addons/3.1.9/raw/inc/modules/display/image-masking/image-masking.php
- Modified: 2026-06-18T08:41:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/master-addons/3.1.9/code/inc/modules/display/image-masking/image-masking.php#L10-L20`.

```php
<?php

/**
 * Add image masking support to some specific widgets
 *
 * @package Master_Addons
 */

namespace MasterAddons\Modules\Display;

use Elementor\Widget_Base;
use MasterAddons\Inc\Controls\Group_Control_Mask_Image;

defined('ABSPATH') || die();

if (!class_exists('MasterAddons\Modules\Display\Image_Masking')) {
class Image_Masking
    {

        public static function init()
        {
            add_action('elementor/element/image/section_image/before_section_end', [__CLASS__, 'add_controls']);
            add_action('elementor/element/image-box/section_image/before_section_end', [__CLASS__, 'add_controls']);
            add_action('elementor/element/ha-card/_section_image/before_section_end', [__CLASS__, 'add_controls']);
            add_action('elementor/element/ha-infobox/_section_media/before_section_end', [__CLASS__, 'add_controls']);
            add_action('elementor/element/ha-promo-box/_section_title/before_section_end', [__CLASS__, 'add_controls']);
            add_action('elementor/element/ha-member/_section_info/before_section_end', [__CLASS__, 'add_controls']);
        }

        /**
         * @param Widget_Base $element
         */
        public static function add_controls(Widget_Base $element)
        {

            $args = self::widget_to_args_map($element->get_name());

            $element->start_injection([
                'type' => 'control',
                'at' => 'after',
                'of' => $args['of'],
            ]);

            $element->add_group_control(
                Group_Control_Mask_Image::get_type(),
                [
                    'name' => 'image_masking',
                    'selector' => '{{WRAPPER}} ' . $args['selector'],
                    'condition' => $args['condition'],
                ]
            );

            $element->end_injection();
        }

        /**
         * @param string $widget_name
         * @return mixed
         */
        public static function widget_to_args_map($widget_name = '')
        {
            $map = [
                'image' => [
                    'of' => 'image',
                    'selector' => '.elementor-image',
                    'condition' => []
                ],
                'image-box' => [
                    'of' => 'image',
                    'selector' => '.elementor-image-box-img',
                    'condition' => []
                ],
                'ha-card' => [
                    'of' => 'image',
                    'selector' => '.ha-card-figure img',
                    'condition' => []
                ],
                'ha-infobox' => [
                    'of' => 'image',
                    'selector' => '.ha-infobox-figure.ha-infobox-figure--image',
                    'condition' => [
                        'type' => 'image'
                    ]
                ],
                'ha-promo-box' => [
                    'of' => 'image',
                    'selector' => '.ha-promo-box-thumb',
                    'condition' => []
                ],
                'ha-member' => [
                    'of' => 'image',
                    'selector' => '.ha-member-figure',
                    'condition' => []
                ]
            ];

            return $map[$widget_name];
        }
    }
}
```
