0

I have created a view(ABC) in which search criteria: "country type content" and other filter is "promoted to front page"."Promoted to front page" filtering content using cck boolen field(yes/no).

Another view(XYZ) has search criteria: "country type content" only.

When promoted to front page cck field is empty or null my first view(ABC) will hide same as I want to hide second view(XYZ) If first view is hidden.

Both the views i placed at same region "Header".

How to hide (XYZ) view, if (ABC)view has no content or hidden?

1 Answer 1

1

For such cases, when visiblity of one view need to be dependent on another view, we may alter the view, or we can use hook_views_pre_render or hook_views_pre_render to control the view through custom code.

Here as you are using block, so you can also use block configuration "Show block on specific pages" instead of coding in some custom module.

Then you can select option "Pages on which this PHP code returns TRUE" there.

After doing so, you can use the following code in the textarea:

<?php

$view = "<Your dependee view's machine name on which other view is dependent>";

$display = "<Your dependee view's display ID>";

$all_row = views_get_view_result($view, $display);

if(count($all_row)>0) {
  return TRUE;
}
?>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.