[development] [views] Knowing the display type of a view
Pierre Rineau
pierre.rineau at makina-corpus.com
Fri Dec 31 11:45:57 UTC 2010
On Fri, 2010-12-31 at 00:04 +0000, Steven Jones wrote:
> Hi,
>
> We tend to use the 'is_a' function, like so:
>
> if (is_a($view->display_handler, 'views_plugin_display_page')) {
> ...
> }
>
> that way if you use a display handler that subclasses the page one,
> you still get your code executed.
>
> http://php.net/manual/en/function.is-a.php
Then why don't use use instanceof ?
if ($view->display_handler instanceof views_plugin_display_page) {
}
<cite>
5.0.0 This function became deprecated in favour of the instanceof
operator. Calling this function will result in an E_STRICT warning.
</cite>
Pierre.
More information about the development
mailing list