Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/elementor-pro/modules/query-control/controls/ |
Upload File : |
<?php namespace ElementorPro\Modules\QueryControl\Controls; use Elementor\Control_Select2; use ElementorPro\Modules\QueryControl\Module; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Query extends Control_Select2 { public function get_type() { return 'query'; } /** * 'query' can be used for passing query args in the structure and format used by WP_Query. * @return array */ protected function get_default_settings() { return array_merge( parent::get_default_settings(), [ 'query' => '', ] ); } /** * Update control settings using mapping config * * @param $value * @param array $control_args * @param array $config * * @return mixed */ public function on_import_update_settings( $value, array $control_args, array $config ) { switch ( $control_args['autocomplete']['object'] ) { case Module::QUERY_OBJECT_POST: case Module::QUERY_OBJECT_LIBRARY_TEMPLATE: return $this->replace_id_from_mapping( $value, $config['post_ids'] ); case Module::QUERY_OBJECT_TAX: return $this->replace_id_from_mapping( $value, $config['term_ids'] ); default: return $value; } } /** * replace id from config * * @param mixed $value * @param array $mapping * * @return string */ private function replace_id_from_mapping( $value, array $mapping ): string { return $mapping[ $value ] ?? $value; } }