Download & Extend

Integration with Panels

Project:Location
Version:6.x-3.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)
Issue tags:location compatibility with other modules

Issue Summary

Attached is code to integrate with Panels 3. Included is a location context, a location from node relationship, and a country name content.

AttachmentSize
location_panels.zip4.67 KB

Comments

#1

I am just needing this! Is there are chance that this plugin will support location provinces so a province context would be available?

#2

What you would do is modify plugins/context/location.inc where it has the following:

<?php
/**
* Provide a list of ways that this context can be converted to a string.
*/
function location_panels_context_location_convert_list() {
    return array(
     
'country_code'        => t('Country Code'),
   
'country_name'        => t('Country Name'),
    );
}

/**
* Convert a context into a string.
*/
function location_panels_context_location_convert($context, $type) {
    switch (
$type) {
        case
'country_code':
            return
$context->data['country'];
        case
'country_name':
            return
$context->data['country_name'];
    }
}
?>

That controls what elements of the context are exposed. You would add 'province' and 'province_name' to the array returned by location_panels_context_location_convert_list and then add those cases to the switch in location_panels_context_location_convert returning $context->data['province'] or ['province_name'] as appropriate as $context->data is a location array loaded location_load_location.

I also notice a bug in location_panels_context_create_location, I have $data = location_load_location($nid), which should probably be $data = location_load_location($lid)

#3

Ok great! Thanks for the response and explanation.

#4

tagging

#5

Status:active» closed (duplicate)

Thanks, I need something just like this. However, let's move discussion over to the original issue for this feature: #487790: Panels integration

nobody click here