You are here

function simplemeta_page_meta_form_ajax_language in Simple Meta 7

AJAX callback for language element of the simplemeta_page_meta_form.

1 string reference to 'simplemeta_page_meta_form_ajax_language'
simplemeta_page_meta_form in ./simplemeta.module
On-page SimpleMeta form builder.

File

./simplemeta.module, line 638
SimpleMeta module.

Code

function simplemeta_page_meta_form_ajax_language($form, $form_state) {
  $_meta = $form_state['values']['_meta'];
  $path = $_meta->path;
  $lang = $form_state['values']['_language'];
  $meta = simplemeta_meta_load_by_path($path, $lang);

  // Try to load language-neutral
  if (!$meta) {
    $meta = new stdClass();
    $meta->path = $path;
    $meta->data = array();
    $meta->language = $lang;
  }
  $form_state = array(
    'build_info' => array(
      'args' => array(
        $meta,
      ),
    ),
    'rebuild_info' => array(
      'copy' => array(
        '#build_id' => TRUE,
        '#action' => TRUE,
      ),
    ),
    'values' => array(),
  ) + form_state_defaults();
  return drupal_rebuild_form('simplemeta_page_meta_form', $form_state, $form);
}