function opengraph_meta_settings_form_submit in Open Graph meta tags 7
Same name and namespace in other branches
- 6 opengraph_meta.admin.inc \opengraph_meta_settings_form_submit()
File
- ./
opengraph_meta.admin.inc, line 98
Code
function opengraph_meta_settings_form_submit($form, &$form_state) {
$values = $form_state['values'];
// save content types enabled
variable_set(OPENGRAPH_META_VAR_CONTENT_TYPES_ENABLED, $values[OPENGRAPH_META_VAR_CONTENT_TYPES_ENABLED]);
// save og:type for each content type
$types = OpenGraphMetaDrupalLayer::get_node_types();
foreach ($types as $id => $data) {
OpenGraphMetaDrupalLayer::update_default_ogtype_for_node_type($id, $values);
}
// save other vars
variable_set(OPENGRAPH_META_VAR_SITE_NAME, $values[OPENGRAPH_META_VAR_SITE_NAME]);
variable_set(OPENGRAPH_META_VAR_FALLBACK_IMG, $values[OPENGRAPH_META_VAR_FALLBACK_IMG]);
// save optional tags
$options = array();
foreach (_opengraph_meta_location_form_fields() as $f => $info) {
$options[$f] = $values['location'][$f];
}
foreach (_opengraph_meta_contact_form_fields() as $f => $info) {
$options[$f] = $values['contact'][$f];
}
variable_set(OPENGRAPH_META_VAR_OPTIONAL_TAGS, $options);
// success
drupal_set_message("All Open Graph Meta Tags options have been updated");
}