function sarnia_entity_manage_form_submit in Sarnia 7
Submit function. Creates a Sarnia entity type for a Search API server.
See also
File
- ./
sarnia.entities.inc, line 195
Code
function sarnia_entity_manage_form_submit($form, &$form_state) {
$server = $form_state['values']['server'];
if ($form_state['clicked_button']['#name'] == 'enable') {
// Create a Sarnia entity type based on this Search API server.
$entity_type = array(
'label' => $server->name . ' (Sarnia index)',
'machine_name' => 'sarnia_' . $server->machine_name,
'search_api_server' => $server->machine_name,
'search_api_index' => 'sarnia_' . $server->machine_name,
'id_field' => $form_state['values']['id_field'],
);
sarnia_entity_type_save($entity_type);
// Rebuild the entity info cache and the menus, so that tabs provided by the
// Field UI module show up immediately.
entity_info_cache_clear();
menu_rebuild();
// Tell the user what just happened.
drupal_set_message(t('Created a Sarnia entity type and a Search API index for the %server_name server.', array(
'%server_name' => $server->name,
)));
}
}