By Prine on
I've searched but couldnt find a similar topic.
How do i import context setting programmatically? I looked at the code generated by Context export facility; but now i don't know what to do with it! Does it go in the .module file like an imagecache preset?
I've seen other examples of inserting context programmatically, for instance this:
$context = array(
'namespace' => 'context_ui',
'attribute' => 'section',
'value' => 'reviews',
'description' => 'reviews context',
'path' => array(
'reviews/*'=>'reviews/*',
'review/*'=>'review/*'
),
'menu' => 'reviews',
);
context_save_context((object) $context);
But throws an undefined function error. Can someone please help? Im trying to replace existing context setting with the new one above!
Cheers
Comments
context_save()
Export the context object using the Context export tool (provided by CTools) and use the context_save function to import.
You can also create an array and convert it to an object if you like.
For more details, see context_save(), line 231; context.module
42droids.co.uk
Thanks
Sorry for late reply, this is perfect. Thanks very much for the heads up :)