Last active
March 28, 2016 21:15
-
-
Save atwellpub/2574dec8582a6d2b6cc8 to your computer and use it in GitHub Desktop.
ninjaforms action development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined( 'ABSPATH' ) ) exit; | |
/** | |
* Class NF_Action_Save | |
*/ | |
final class NF_Actions_Inbound_Store_Lead extends NF_Abstracts_Action | |
{ | |
/** | |
* @var string | |
*/ | |
protected $_name = 'inbound-now-integration'; | |
/** | |
* @var array | |
*/ | |
protected $_tags = array(); | |
/** | |
* @var string | |
*/ | |
protected $_timing = 'normal'; | |
/** | |
* @var int | |
*/ | |
protected $_priority = '10'; | |
/** | |
* Constructor | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->_nicename = __( 'Inbound Now Store Lead', 'inbound-pro' ); | |
// $ninja_form_fields = Ninja_Forms()->form( $_GET['form_id'] )->get_fields( ); | |
$fields = Leads_Field_Map::get_lead_fields(); | |
$fields = Leads_Field_Map::prioritize_lead_fields( $fields ); | |
$field_mapping_settings = array(); | |
foreach ($fields as $key => $field) { | |
/**/ | |
$field_mapping_settings[$field['key']] = array( | |
'name' => $field['key'], | |
'type' => 'textbox', | |
'label' => $field['label'], | |
'width' => 'one-half', | |
'group' => 'primary', | |
'value' => '', | |
'use_merge_tags' => TRUE, | |
'help' => __( 'Map your Ninja Form fields to Inbound Now\'s Leads database', 'inbound-pro' ) | |
); | |
/**/ | |
} | |
error_log(print_r($field_mapping_settings,true)); | |
$this->_settings['field-mapping'] = array( | |
'name' => 'field-mapping', | |
'type' => 'fieldset', | |
'label' => 'Field Mapping', | |
'group' => 'primary', | |
'settings' => $field_mapping_settings | |
); | |
} | |
/* | |
* PUBLIC METHODS | |
*/ | |
public function save( $action_settings ) | |
{ | |
} | |
public function process( $action_settings, $form_id, $data ) | |
{ | |
return $data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment