Advertisement
verygoodplugins

Untitled

Aug 29th, 2019
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. // Here's my custom control
  2.  
  3. $widget->add_control(
  4.     'wpf_fields_map',
  5.     [
  6.         'label' => sprintf( __( '%s Field Mapping', 'elementor-pro' ), wp_fusion()->crm->name ),
  7.         'type' => Fields_Map::CONTROL_TYPE,
  8.         'separator' => 'before',
  9.         'fields' => [
  10.             [
  11.                 'name' => 'remote_id',
  12.                 'type' => Controls_Manager::HIDDEN,
  13.             ],
  14.             [
  15.                 'name' => 'local_id',
  16.                 'type' => Controls_Manager::SELECT,
  17.             ],
  18.         ],
  19.         'default'   => $this->get_fields(),
  20.     ]
  21. );
  22.  
  23. // Need to merge in new fields....
  24.  
  25. $settings = $widget->get_settings();
  26.  
  27. if ( ! empty( $settings['wpf_fields_map'] ) ) {
  28.  
  29.     $fields         = $this->get_fields();
  30.     $new_fields_map = array_merge( $fields, $settings['wpf_fields_map'] );
  31.     $widget->set_settings( 'wpf_fields_map', $new_fields_map );
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement