In search_api_page_admin_add() we have this code:
$view_modes = array(
'search_api_page_result' => t('Themed as search results'),
);
// For entities, we also add all entity view modes.
if ($entity_info = entity_get_info($index->item_type)) {
foreach ($entity_info['view modes'] as $mode => $mode_info) {
$view_modes[$mode] = $mode_info['label'];
}
}
if (count($view_modes) > 1) {
$form['view_mode'] = array(
'#type' => 'select',
'#title' => t('View mode'),
'#options' => $view_modes,
'#description' => t('Select how search results will be displayed.'),
'#size' => 1,
'#default_value' => 'search_api_page_result',
);
}
else {
$form['view_mode'] = array(
'#type' => 'value',
'#value' => reset($view_modes),
);
}
If we are creating a search page with non-entities, the reset($view_modes) returns the item value ("Themed as search results"), not the key. Patch attached :)
Comments
Comment #1
amateescu commentedSame error in
search_api_page_admin_edit().Comment #2
bblake commentedRan into the same problem. Verified the patch fixes it.
Comment #3
drunken monkeyCommitted, thanks a lot for spotting and fixing!