Created
September 13, 2011 19:29
-
-
Save johnrobertwilson/1214818 to your computer and use it in GitHub Desktop.
Entities by typ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Form builder for the bundle configuration form. | |
* | |
* @see apachesolr_indexer_config_form_submit(). | |
*/ | |
function apachesolr_indexer_config_form() { | |
$form['bundles'] = array( | |
'#type' => 'markup', | |
'#markup' => t('Select the entity types and bundles that should be indexed.'), | |
); | |
// For future extensibility, when we have multiple cores. | |
$form['core'] = array( | |
'#type' => 'value', | |
'#value' => 'default', | |
); | |
foreach (entity_get_info() as $entity_type => $entity_info) { | |
if ($entity_info['apachesolr']['indexable']) { | |
$options = array(); | |
foreach ($entity_info['bundles'] as $key => $info) { | |
$options[$key] = $info['label']; | |
} | |
$form['entities']['#tree'] = TRUE; | |
$form['entities'][$entity_type] = array( | |
'#type' => 'checkboxes', | |
'#title' => $entity_info['label'], | |
'#options' => $options, | |
'#default_value' => apachesolr_indexer_get_bundles('default', $entity_type), | |
); | |
} | |
} | |
$form['submit'] = array('#type' => 'submit', '#value' => t('Save')); | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment