Requirements:
- CKAN 2.3+
- Drupal site with menu_export module installed
- Python 2.6 or 2.7
Drupal Setup:
1. Install custom menu_export module on Drupal site:
- Module files located in drupal_custom_module_menu_export directory
- Copy module to Drupal’s modules directory
- Enable module in Drupal admin interface
- Configure menu_export module:
- Module provides JSON endpoint exposing Drupal menu structure
- Default endpoint: {drupal_site}/menu-export
CKAN Installation:
Activate CKAN virtualenv:
. /usr/lib/ckan/default/bin/activate
Install extension for development:
git clone git@git.links.com.au:smotornyuk/ckanext-drupal_menu_sync.git
cd ckanext-drupal_menu_sync
python setup.py develop
Or install from GitHub:
pip install -e git+https://github.com/DataShades/ckanext-drupal_menu_sync#egg=ckanext-drupal_menu_sync
Add plugin to ckan.plugins in production.ini:
ckan.plugins = … drupal_menu_sync …
Configure Drupal site URL in production.ini:
drupal.site_url = https://your-drupal-site.com
If not specified, defaults to CKAN instance root URL.
Restart CKAN:
sudo service apache2 restart
Configuration Options:
URL of Drupal instance (defaults to CKAN root if not specified)
drupal.site_url = https://your-drupal-site.com
Usage:
Automatic Menu Sync:
- Once configured, CKAN automatically fetches menu structure from Drupal
- Drupal menu items appear in CKAN navigation
- Menu updates in Drupal automatically reflected in CKAN
- No manual synchronization required
Menu Export Endpoint:
- Drupal menu_export module provides JSON endpoint
- Endpoint returns menu structure in JSON format
- CKAN fetches and parses menu data
- Menu items inserted into CKAN navigation templates
Drupal Module (menu_export):
The custom menu_export module must be installed on Drupal:
Location:
- Files included in drupal_custom_module_menu_export directory
- Standard Drupal module structure
Installation:
1. Copy menu_export directory to Drupal’s sites/all/modules/ or modules/ directory
2. Enable module in Drupal admin: Admin → Modules → menu_export
3. Clear Drupal cache
Functionality:
- Exposes Drupal menus as JSON
- Provides endpoint for CKAN to consume
- Configurable which menus to export
- Supports nested menu structures
Testing:
Run tests:
nosetests –nologcapture –with-pylons=test.ini
Run tests with coverage:
pip install coverage
nosetests –nologcapture –with-pylons=test.ini –with-coverage –cover-package=ckanext.drupal_menu_sync –cover-inclusive –cover-erase –cover-tests
Troubleshooting:
Menus not syncing:
- Verify drupal.site_url is correct in CKAN config
- Check menu_export module is enabled in Drupal
- Test Drupal menu export endpoint directly: {drupal_site}/menu-export
- Check CKAN logs for connection errors
Menu items not displaying:
- Verify Drupal menus are published
- Check menu permissions in Drupal
- Clear both CKAN and Drupal caches
- Verify menu structure is valid JSON
Connection errors:
- Verify CKAN server can reach Drupal site
- Check firewall rules
- Verify SSL certificates if using HTTPS
- Test connectivity: curl {drupal_site}/menu-export
Development Status: Beta (4)
License: AGPL v3.0 or later
Keywords: CKAN, Drupal, menu, navigation, integration
Developer: Link Digital (Sergey Motornyuk)
Use Case:
- Organizations running both CKAN and Drupal
- Need consistent navigation across platforms
- Drupal as main portal, CKAN as data catalog
- Seamless user experience between systems