register_action_type( $action ); } do_action( 'jet-form-builder/actions/register', $this ); } /** * Register new action type * * @param [type] $type [description] * * @return [type] [description] */ public function register_action_type( $type ) { if ( $type->dependence() ) { $this->_types[ $type->get_id() ] = $type; } } /** * @return array */ public function get_actions() { return $this->_types; } /** * Regsiter action types data for the editor * * @return [type] [description] */ public function register_types_for_editor( $editor, $handle ) { $prepared_types = array(); foreach ( $this->_types as $type ) { $prepared_types[] = array( 'id' => $type->get_id(), 'name' => $type->get_name(), 'callback' => false, // should be rewritten from JS ); $type->action_data( $editor, $handle ); } wp_localize_script( $handle, 'jetFormActionTypes', $prepared_types ); } }