Right now the farm farm_location_reference
view is a simple Entity Reference List of any location asset (where is_location = True
). It would be nice if this could also filter by the asset type, so as to only display structure or land asset locations.
I tried configuring the asset_type as an exposed filter but it did not work. Configuring this as a contextual filter should work instead.
N/A
Configure an asset_type contextual filter on the farm_location_reference view:
This can then be configured in a entity_autocomplete
form field with the following:
// Location field.
$form['location'] = [
'#type' => 'entity_autocomplete',
'#title' => $this->t('Structure or land location'),
'#target_type' => 'asset',
'#selection_handler' => 'views',
'#selection_settings' => [
'view' => [
'view_name' => 'farm_location_reference',
'display_name' => 'entity_reference',
'arguments' => ['structure+land'],
],
'match_operator' => 'CONTAINS',
'match_limit' => 10,
],
'#multiple' => TRUE,
];
Implement
None.
None.
None.
Active
3.0
Miscellaneous
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.