Skip to content

Instantly share code, notes, and snippets.

@Shelob9 Shelob9/all-options.php

Last active Apr 2, 2017
Embed
What would you like to do?
<?php
function my_processor_fields(){
return array(
array(
//Required. his is the ID you use to get the field's value
'id' => 'customer_id',
//yRequired (unless field is hidden). Provides text to be used in the <label> element
'label' => __( 'Customer ID', 'text-domain' ),
//this is optional, default is text. Other options are: checkbox|advanced|dropdown|hidden
'type' => 'text',
//Optional. Makes field required or not by default field is not required.
'required' => true,
//Optional. If true magic tags are allowed, if false, they are not. Default is true, to allow.
'magic' => true,
//Optional. The description for the element. By default you can not pass HTML here.
'desc' => __( 'The unique customer ID', 'text-domain' ),
//Optional. If true, the 'desc' argument is assumed to be safe, and will not be passed through esc_html(). Default is true.
'desc_escaped' => false,
//Optional. If true the input will be block (full-width) should be used most of the time (is the default) except for checkboxes.
'block' => true,
//Optional. An array of additional classes to add to the input/select
'extra_classes' => array( 'my-class', 'another-class' ),
//Optional. Only works with "advanced" types. Pass an array of field types you would allow to be mapped to this setting.
'allow_types' => array( 'file', 'advanced_file' ),
//Optional. Only works with "advanced" types. Pass an array of field types you would NOT allow to be mapped to this setting.
'exclude' => array( 'file', 'advanced_file' ),
),
);
}
<?php
function my_processor_fields(){
return array(
array(
'id' => 'customer_id',
'label' => __( 'Customer ID', 'text-domain' ),
'required' => true,
),
array(
'id' => 'customer_email',
'type' => 'advanced',
'label' => __( 'Customer Email', 'text-domain' ),
'required' => true,
'allow_types' => array( 'email' )
),
array(
'id' => 'customer_phone',
'type' => 'advanced',
'label' => __( 'Customer Phone', 'text-domain' ),
'required' => true,
'allow_types' => array( 'phone', 'phone_better' )
),
array(
'id' => 'customer_type',
'type' => 'dropdown',
'label' => __( 'Customer Type', 'text-domain' ),
//select options are provided as $value => $label
//First option translates to <option value="super">Super</option>
'options' => array(
'super' => __( 'Super', 'text-domain' ),
'awesome' => __( 'Awesome', 'text-domain' ),
'apex' => __( 'Apex', 'text-domain' ),
),
),
array(
'id' => 'customer_notes',
'required' => false,
'label' => __( 'Customer Notes', 'text-domain' ),
'desc' => 'See <a href="http://something.com">the manual</a> for information about notes.',
//desc has HTML so we must set it to be trusted or the link will not work.
'desc_escaped' => true
),
//this is a hidden field, let's assume that it will get set with JavaScript or something
array(
'id' => 'customer_thing',
'type' => 'hidden'
),
);
}
<?php
/**
* Example Caldera Forms Processor config to be used with Caldera_Forms_Processor_Processor class.
*
* DO NOT pass directly to caldera_forms_get_form_processors filter
*/
array(
//Processor name. Required.
'name' => __( 'Apex Processor', 'text-domain'),
//Processor description. Required
'description' => __( 'A Caldera Form Add-on Of Industry', 'text-domain'),
//File form processor UI. Optional. But recommended
'template' => dirname( __FILE__ ) . '/includes/config.php',
//Url of icon, Optional. Default is gears dashicon
'icon' => plugin_dir_url( __FILE__ ) . '/icon.png',
//Author name, Optional. No HTML
'author' => 'Mike Corkum',
//Author URL. Optional. If used author name will be a link.
'author_url' => 'http://fighterjet.io',
//Minimum supported Caldera Forms version
'cf_ver' => '1.5.0'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.