if ($view->name === 'view_name_here')
{
}

this condtion is not working

can anyone tell me how to check the current view name.

CommentFileSizeAuthor
#3 example.png31.22 KBrenatog
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dshields’s picture

Provide more details. Into what file are you trying to insert this code?

Subhransu.addweb’s picture

As you know
$x == $y Returns true if $x is equal to $y.

$x === $y Returns true if $x is equal to $y, and they are of the same type And check case sensitive.

So, print you view and find view->name copy it and set in condition.

Hope this helps!

Thanks

renatog’s picture

Issue summary: View changes
Status: Active » Reviewed & tested by the community
FileSize
31.22 KB

Yes, thank you very much Denisha.

It's ok.

+RTBC

@dshields, using '===' you will compare if identical. For this please print $view->name and check how to return. After it, you can make de condition identical.

This is a basic example used in hosting site project:

renatog’s picture

Status: Reviewed & tested by the community » Fixed

If have questions about it please comment here for us.

Thank you very much people.

Good Work.

Regards.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.