onemanonelaptop/diy — Issue #22: Add Lat/long fields to a map field automatically
Author: onemanonelaptop
Created: 2012-01-29 20:51:11+00:00
State: open

Add Lat/long fields to a map field automatically, currently

$this->field(
array(
"metabox" => "field-tests-single", // the id of the metabox this field resides inside
"group" => "test-location-single", // The form field name
"title" => "Location", // Title used when prompting for input
"max" => "1",
"fields" => array(
"map" => array(
"type" => "map",
"title" => "Select the location by clicking on the map",
"label_style" => "block",
"description" => "",
"placeholder" => "",
"width" => "",
"height" => "250",
"tooltip" => "",
"latfield" => "test-location-single[0][latitude]",
"longfield" => "test-location-single[0][longitude]"
),
"latitude" => array(
"type" => "text",
"title" => "Latitude",
"label_style" => "inline",
"label_width" => "100",
"description" => "",
"placeholder" => "",
"width" => "",
"height" => "",
"tooltip" => ""
),
"longitude" => array(
"type" => "text",
"title" => "Longitude",
"label_style" => "inline",
"label_width" => "100",
"description" => "",
"placeholder" => "",
"width" => "",
"height" => "",
"tooltip" => ""
)
) // end fields
) // end array
);

proposed

$this->field(
array(
"metabox" => "field-tests-single", // the id of the metabox this field resides inside
"group" => "test-location-single", // The form field name
"title" => "Location", // Title used when prompting for input
"max" => "1",
"fields" => array(
"map" => array(
"type" => "map",
"title" => "Select the location by clicking on the map",
"label_style" => "block",
"description" => "",
"placeholder" => "",
"width" => "",
"height" => "250",
"tooltip" => "")
) // end fields
) // end array
);