mcfadden / Easy-iContact---WordPress-plugin

Plugin for WordPress that makes integration with iContact point and click (and paste the shortcode)
6 stars 1 forks source link

Custom Field Support #7

Closed mcfadden closed 12 years ago

mcfadden commented 12 years ago

Need to work out the best way to support custom fields.

mcfadden commented 12 years ago

Tentatively we could take in an array as one of the shortcode options:

array(
  "foo" => array(
    "type" => "text",
    "label" => "Foo"
  ),
  "bar" => array(
    "type" => "select",
    "options" => array(
      "",
      "Foo Bar" => "foo-bar",
      "abcd"
    ),
    "label" = "Bar")
);

Could generate output similar to:

<label for="fields_foo">Foo</label>
<input type="text" name="fields_foo" />

<label for="fields_bar">Bar</label>
<select name="fields_bar">
  <option value=""></option>
  <option value="foo-bar">Foo Bar</option>
  <option value="abcd">abcd</option>
</select>
mcfadden commented 12 years ago

JSON will probably be a better choice to pass in:

{
    "foo": {
        "type": "text",
        "label": "Foo"
    },
    "bar": {
        "type": "select",
        "options": {
            "FooBar": "foo-bar",
            "abcd": "abcd"
        },
        "blank": "true",
        "label": "Bar"
    }
}

The shortcode would look like:

[easyicontact custom_fields='{"foo": {"type": "text","label": "Foo"},"bar": {"type": "select","options": {"FooBar": "foo-bar","abcd": "abcd"},"blank": "true","label": "Bar"}}' ]