function _opengraph_meta_location_form_fields in Open Graph meta tags 6
Same name and namespace in other branches
- 7 opengraph_meta.module \_opengraph_meta_location_form_fields()
3 calls to _opengraph_meta_location_form_fields()
- opengraph_meta_form_alter in ./
opengraph_meta.module - Implementation of hook_form_alter.
- opengraph_meta_settings_form in ./
opengraph_meta.admin.inc - Menu callback: settings form.
- opengraph_meta_settings_form_submit in ./
opengraph_meta.admin.inc
File
- ./
opengraph_meta.module, line 131
Code
function _opengraph_meta_location_form_fields($node = NULL) {
$ret = array();
$fields = array(
OpenGraphMeta::LATITUDE => array(
'Latitude',
'Geographical latitude as a decimal number.',
),
OpenGraphMeta::LONGITUDE => array(
'Longitude',
'Geographical longitude as a decimal number.',
),
OpenGraphMeta::STREET_ADDRESS => array(
'Street address',
'Local street address.',
),
OpenGraphMeta::LOCALITY => array(
'Locality',
'E.g. town or city.',
),
OpenGraphMeta::REGION => array(
'Region',
'Region within country, e.g. a county.',
),
OpenGraphMeta::POST_CODE => array(
'Post code',
'Postal code.',
),
OpenGraphMeta::COUNTRY_NAME => array(
'Country',
'Full country name.',
),
);
$defaults = OpenGraphMeta::instance()
->get_og_optional_tag_defaults($node);
foreach ($fields as $f => $i) {
$default_value = '';
if (!empty($node->opengraph_meta) && !empty($node->opengraph_meta[$f])) {
$default_value = $node->opengraph_meta[$f];
}
$ret[$f] = array(
'#title' => t($i[0]),
'#type' => 'textfield',
'#maxlength' => 255,
'#default_value' => $default_value,
'#description' => t($i[1]),
);
// global fallback value?
if (!empty($node) && isset($node->nid) && !empty($defaults[$f])) {
$ret[$f]['#description'] .= t(' If left unset then the global fallback value will be used: "@s"', array(
'@s' => $defaults[$f],
));
}
}
return $ret;
}