| @@ -2,37 +2,14 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\Shapes; |
| 4 | 4 | |
| 5 | 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 6 | - exit; // Exit if accessed directly. | |
| 6 | + exit; // Exit if accessed directly | |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | class Module extends \Elementor\Core\Base\Module { |
| 10 | 10 | |
| 11 | - public function __construct() { | |
| 12 | - parent::__construct(); | |
| 13 | - | |
| 14 | - add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] ); | |
| 15 | - } | |
| 16 | - | |
| 17 | 11 | /** |
| 18 | - * Register styles. | |
| 19 | - * | |
| 20 | - * At build time, Elementor compiles `/modules/shapes/assets/scss/frontend.scss` | |
| 21 | - * to `/assets/css/widget-shapes.min.css`. | |
| 22 | - * | |
| 23 | - * @return void | |
| 24 | - */ | |
| 25 | - public function register_styles() { | |
| 26 | - wp_register_style( | |
| 27 | - 'widget-text-path', | |
| 28 | - $this->get_css_assets_url( 'widget-text-path', null, true, true ), | |
| 29 | - [ 'elementor-frontend' ], | |
| 30 | - ELEMENTOR_VERSION | |
| 31 | - ); | |
| 32 | - } | |
| 33 | - | |
| 34 | - /** | |
| 35 | 12 | * Return a translated user-friendly list of the available SVG shapes. |
| 36 | 13 | * |
| 37 | 14 | * @param bool $add_custom Determine if the output should include the `Custom` option. |
| 38 | 15 | * |
| @@ -55,16 +32,23 @@ | ||
| 55 | 32 | return $paths; |
| 56 | 33 | } |
| 57 | 34 | |
| 58 | 35 | /** |
| 59 | - * Get an SVG Path URL from the pre-defined ones. | |
| 36 | + * Gets an SVG path name as a parameter and returns its SVG markup from the `svg-paths` | |
| 37 | + * folder under the assets directory. | |
| 60 | 38 | * |
| 61 | - * @param string $path - Path name. | |
| 39 | + * @param $path string Path name. | |
| 62 | 40 | * |
| 63 | - * @return string | |
| 41 | + * @return string The path SVG markup. | |
| 64 | 42 | */ |
| 65 | - public static function get_path_url( $path ) { | |
| 66 | - return ELEMENTOR_ASSETS_URL . 'svg-paths/' . $path . '.svg'; | |
| 43 | + public static function get_path_svg( $path ) { | |
| 44 | + $file_name = ELEMENTOR_ASSETS_PATH . 'svg-paths/' . $path . '.svg'; | |
| 45 | + | |
| 46 | + if ( ! is_file( $file_name ) ) { | |
| 47 | + return ''; | |
| 48 | + } | |
| 49 | + | |
| 50 | + return file_get_contents( $file_name ); | |
| 67 | 51 | } |
| 68 | 52 | |
| 69 | 53 | /** |
| 70 | 54 | * Get the module's associated widgets. |