Hi everyone.
I was looking for previous information about this matter but i found nothing related to my specific issue.
What i'd like to know is:
How is it possible to check if a context is active or not in Context-3.x?
I ask this because when i had Context-2.x i used

if context_get($namespace, $attribute) == 'context_1' {
 do something 

And now that i updated Context to the latest version this function doesn't seem to work anymore. I simply can't find the proper equivalent of this. It's maybe because the function changed or the name of the context you set up is no longer having the same "format" than old Context version.

In my specific case the same context was this in Context-2.x

namespace: context_ui
attribute: section
value: context_1
description: bam bam bam

and this in Context-3.x

name: context_ui-section-context_1
tag: section
description: bam bam bam

I am a bit confused @_@

Comments

markabur’s picture

Context 3.x got rid of the idea of namespaces, but the argument is still there -- do this:

if (context_get('context', 'context_ui-section-context_1') {

N4R4YAN’s picture

Thank you so much markabur.
Now it works like a charm. I also tried to do some tests with "combination" of names given by context db schema but always left 'context_ui' as first parameter...
So basically now the function is
context_get('context', $name)
i think context is a constant as first paramenter...what is the point of writing anything else in there?
Again, thanks :)

markabur’s picture

Glad it worked. That tripped me up for a while with the Context upgrade too.

I think it's possible for a module to create a custom namespace, in which there would be something other than 'context' as the first parameter, but I haven't come across this in the real world.

N4R4YAN’s picture

Ok, this makes sense.
Now everything is up and working fine. Thanks again for your support :)
Happy Drupaling :D

PS: And hopefully this will help other drupal users