/home/websdxuk/dannymattinezllc.com/wp-content/plugins/elementor-pro/base/on-import-trait.php
<?php
namespace ElementorPro\Base;

use Elementor\Element_Base;
use ElementorPro\Modules\QueryControl\Controls\Query;
use ElementorPro\Plugin;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

trait On_Import_Trait {

	/**
	 * On import update dynamic content (e.g. post and term IDs).
	 *
	 * @since 3.8.0
	 *
	 * @param array              $element_config The config of the passed element.
	 * @param array              $data           The data that requires updating/replacement when imported.
	 * @param array|Element_Base $controls       The available controls.
	 *
	 * @return array
	 */
	public static function on_import_update_dynamic_content( array $element_config, array $data, $controls = null ) : array {
		if ( $controls instanceof Element_Base ) {
			$element_config = $controls->on_import_update_dynamic_content( $element_config, $data );
			$controls = $controls->get_controls();
		}

		if ( ! is_array( $controls ) ) {
			return $element_config;
		}

		$available_control_types = Plugin::elementor()->controls_manager->get_controls();

		foreach ( $controls as $control ) {
			$element_config = static::on_import_update_control( $element_config, $data, $control, $available_control_types );
		}

		return $element_config;
	}

	/**
	 * Check if a control requires updating, and do so if needed.
	 *
	 * @param array $element_config
	 * @param array $data
	 * @param array $control
	 * @param array $available_control_types
	 *
	 * @return array
	 */
	private static function on_import_update_control( array $element_config, array $data, array $control, array $available_control_types ) : array {
		$control_value = $element_config['settings'][ $control['name'] ] ?? null;

		if ( empty( $control_value ) || ! $available_control_types[ $control['type'] ] instanceof Query ) {
			return $element_config;
		}

		$required_data = static::on_import_get_required_data( $data, $control['name'] );

		if ( empty( $required_data ) ) {
			return $element_config;
		}

		if ( is_array( $control_value ) ) {
			foreach ( $control_value as $value ) {
				$element_config = static::on_import_update_control_value( $element_config, $required_data, $control['name'], $value );
			}
		} else {
			$element_config = static::on_import_update_control_value( $element_config, $required_data, $control['name'], $control_value );
		}

		return $element_config;
	}

	/**
	 * Returns the data type that is required for updating.
	 *
	 * @param array $data
	 * @param string $control_name
	 *
	 * @return array
	 */
	private static function on_import_get_required_data( array $data, string $control_name ) : array {
		if ( strpos( $control_name, 'term_ids' ) !== false ) {
			return $data['term_ids'];
		}

		if ( static::on_import_check_post_type( $control_name ) ) {
			return $data['post_ids'];
		}

		return [];
	}

	/**
	 * Are the control values post IDs?
	 *
	 * @param string $control_name
	 *
	 * @return bool
	 */
	private static function on_import_check_post_type( string $control_name ) : bool {
		return strpos( $control_name, 'post_ids' ) !== false || in_array( $control_name, [ 'post_id', 'template_id', 'popup' ] );
	}

	/**
	 * Update the value for the dynamic control.
	 *
	 * @param array $element_config
	 * @param array $data
	 * @param string $control_name
	 * @param $current_value
	 *
	 * @return array
	 */
	private static function on_import_update_control_value( array $element_config, array $data, string $control_name, $current_value ) : array {
		if ( ! isset( $data[ $current_value ] ) ) {
			return $element_config;
		}

		if ( is_array( $element_config['settings'][ $control_name ] ) ) {
			$element_config['settings'][ $control_name ] = array_map( function( $item ) use ( $data, $current_value ) {
				return $item === $current_value ? $data[ $current_value ] : $item;
			}, $element_config['settings'][ $control_name ] );
		} else {
			$element_config['settings'][ $control_name ] = $data[ $current_value ];
		}

		return $element_config;
	}
}
My Blog – My WordPress Blog

Navigating Your Journey, Relocating Your World

Elevate Your Move, Experience Seamless Relocations.

A leading innovator in orchestrating top-notch Moving Solutions and Ensuring Seamless Relocations across the USA.

Booked Your Movement

Goods Packing Service

Goods Unpacking Service

Moving Goods Service

Goods Unloading Service

Service

Choose Your Movement Service

Start From 10 USD/Hour

Complete Goods Packing Service for House

All aspects of your software assets including purchasing, deployment & maintenance.

Start From 15 USD/Hour

Complete Goods Unpacking Service for House

All aspects of your software assets including purchasing, deployment & maintenance.

Start From 100 USD/Month

Complete Storage Solution For Your Goods

All aspects of your software assets including purchasing, deployment & maintenance.

Start From 100 USD/Month

Complete Unloading Solution For Your Goods

All aspects of your software assets including purchasing, deployment & maintenance.

Get 10% Discount For Every First of Order. 

View All Our Service Here

WHY CHOOSE US

Explore Why Our Company is Preferable

At [Your Company Name], we pride ourselves on delivering exceptional value, unparalleled service, and innovative solutions tailored to meet your needs.

No Hidden Price

Free Unloading

Clean No Trash

Warehouse

Fast Truck

About Us

Swift Your Transitions With Unmatched Service

At [Your Company Name], we are more than just a business—we are a team of passionate professionals dedicated to delivering excellence. With [X] years of experience in [your industry], we’ve built a reputation for [key strengths, e.g., innovation, reliability, customer-centric solutions].

Thinking insights, verified driven research, and metrics data help you make the right decisions!

Achievments

Moving You Forward By Moving with Care

At [Your Company Name], we take pride in our milestones and the impact we’ve made. Our journey is marked by dedication, innovation, and a relentless pursuit of excellence. Here’s a glimpse of what we’ve accomplished:

Every achievement reflects our commitment to excellence and the trust our clients and partners place in us. We’re not just celebrating the past—we’re building an even brighter future.

0 +

Clients

0 +

Miles

0 +

Movers

Study Case

Learn Our Successfull Study Cases

Urban, Relocations

From City to Suburbs: A Smooth Urban Relocation

Corporate, Precision

Corporate Precision: Streamlining Office Moves

Senior, Transitions

Senior Transitions: Compassionate Moves for Aging Loved Onesz

Cross, Country

Cross-Country Adventure: A Transcontinental Move

Booked Form

Don't Let Your Back Hurt, Let Us Move Your Things!

Our easy-to-use booking form ensures a seamless experience, allowing you to choose your preferred date, time, and options without any hassle.

Why book with us?
✓ Instant Confirmation – Receive immediate booking details via email/SMS.
✓ Flexible Scheduling – Pick a slot that fits your schedule.
✓ 100% Secure – Your information is safe with us.

Booked Your Movement

Booked Your Movement