Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
if ($view->name === 'view_name_here')
{
}
this condtion is not working
can anyone tell me how to check the current view name.
Comment | File | Size | Author |
---|
Comments
Comment #1
dshields CreditAttribution: dshields at OpenConcept Consulting Inc. commentedProvide more details. Into what file are you trying to insert this code?
Comment #2
Subhransu.addweb CreditAttribution: Subhransu.addweb at AddWeb Solution Pvt. Ltd. commentedAs 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
Comment #3
renatogYes, 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:
Comment #4
renatogIf have questions about it please comment here for us.
Thank you very much people.
Good Work.
Regards.