class geofieldProximityEntityURL in Geofield 7.2
@file Contains geofieldProximityEntityURL.
Hierarchy
- class \geofieldProximityBase implements geofieldProximityPluginInterface
- class \geofieldProximityEntityURL implements geofieldProximityPluginInterface
Expanded class hierarchy of geofieldProximityEntityURL
1 string reference to 'geofieldProximityEntityURL'
- geofield_proximity_views_handlers in views/
geofield.views.inc - Implements hook proximity_views_handlers().
File
- views/
proximity_plugins/ geofieldProximityEntityURL.inc, line 8 - Contains geofieldProximityEntityURL.
View source
class geofieldProximityEntityURL extends geofieldProximityBase implements geofieldProximityPluginInterface {
public function option_definition(&$options, $views_plugin) {
$options['geofield_proximity_entity_url_entity_type'] = array(
'default' => 'node',
);
$options['geofield_proximity_entity_url_field'] = array(
'default' => '',
);
$options['geofield_proximity_entity_url_delta'] = array(
'default' => 0,
);
}
public function options_form(&$form, &$form_state, $views_plugin) {
$entities = entity_get_info();
$entity_options = array();
foreach ($entities as $key => $entity) {
$entity_options[$key] = $entity['label'];
}
$form['geofield_proximity_entity_url_entity_type'] = array(
'#type' => 'select',
'#title' => t('Entity Type'),
'#default_value' => $views_plugin->options['geofield_proximity_entity_url_entity_type'],
'#options' => $entity_options,
'#dependency' => array(
'edit-options-source' => array(
'entity_from_url',
),
),
);
$geofields = _geofield_get_geofield_fields();
$field_options = array();
foreach ($geofields as $key => $field) {
$field_options[$key] = $key;
}
$form['geofield_proximity_entity_url_field'] = array(
'#type' => 'select',
'#title' => t('Source Field'),
'#default_value' => $views_plugin->options['geofield_proximity_entity_url_field'],
'#options' => $field_options,
'#dependency' => array(
'edit-options-source' => array(
'entity_from_url',
),
),
);
}
public function getSourceValue($views_plugin) {
$entity_type = $views_plugin->options['geofield_proximity_entity_url_entity_type'];
$geofield_name = $views_plugin->options['geofield_proximity_entity_url_field'];
$delta = $views_plugin->options['geofield_proximity_entity_url_delta'];
$entity = menu_get_object($entity_type);
if (isset($entity) && !empty($geofield_name)) {
$field_data = field_get_items($entity_type, $entity, $geofield_name);
if ($field_data != FALSE) {
return array(
'latitude' => $field_data[$delta]['lat'],
'longitude' => $field_data[$delta]['lon'],
);
}
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
geofieldProximityBase:: |
public | function |
Overrides geofieldProximityPluginInterface:: |
2 |
geofieldProximityBase:: |
public | function |
Overrides geofieldProximityPluginInterface:: |
1 |
geofieldProximityBase:: |
public | function |
Overrides geofieldProximityPluginInterface:: |
|
geofieldProximityEntityURL:: |
public | function |
Overrides geofieldProximityBase:: |
|
geofieldProximityEntityURL:: |
public | function |
Overrides geofieldProximityBase:: |
|
geofieldProximityEntityURL:: |
public | function |
All methods in geofieldProximityPluginInterface maps directly to a
method in a views_handler class, expect for 'getSourceValue,' which
is primarily called in the 'query' method, but also in other instances. Overrides geofieldProximityBase:: |