Account created on 4 December 2016, over 7 years ago
#

Recent comments

I was having the same question and found the solution here:
https://drupal.stackexchange.com/questions/2321/hide-a-view-if-less-than...

Add this to template.php:

function MY_THEME_NAME_preprocess_views_view(&$vars) {
  if ($vars['display_id'] == 'MY_DISPLAY_ID' && count($vars['view']->result) < 2) {
    $vars['view']->result = NULL;
  }
}

and replace "MY_THEME_NAME" by your actual theme name and "MY_DISPLAY_ID" by a unique views ID (your can specify it in the advanced settings of your view). You can also custom the number of elements to determine when to hide the view

Patch in #2 applies nicely, thanks for the contribution !
By the way, to make it work, it requires to use global tokens and not views token replacements. For example, to display node title, use [node:title] instead of [title].

I used method in #9 to hide the first/last inactive items, but a template php function would be better to entirely remove the elements. I'll share my code here if I managed to accomplish this.

Thanks for the stable release. Given the issue I described in #6 still happens with 7.x-1.2, I had to correct it via CSS, which is not the ideal solution.

In my case, I needed to create a direct link to edit one's profile for regulars users. To accomplish this, I had to install the "me alias" module and edit the link into the DB while I thought it would have been possible to do it with this path as a shortcut "user/[current-user:uid]/edit".

Sorry I created this issue by mistake, you can delete it.

Your patch applies correctly, and it seems to solve the issue. Thank you!

However, I noticed another one: for some text formats, I hid in wysiwyg the text format selection and the tips, but I allowed the ability to switch on and off the rich text editor. With the Beta5 release, the toggle wrapper block for this option is included into the fieldset with the "element-invisible" class, which hides the option while I need it visible.

Maybe I should open another issue about this problem, and we can mark this current issue as RTBC?

+1
What is even odder is that it happened to me on some particular fields, not all of them.

I also have that bug, on specific usage:
When I try to edit any content type display, for example changing a text format, when ajax loads I first get an error message:
http ajax error 406.
Then the watchdog logs two errors: Invalid POST form datas and Notice : Undefined index: form_build_id in ajax_get_form() (line 326 in [...]/includes/ajax.inc).
I don't know if my issue is related, I tried to apply your patch, but it doesn't solve it.

My configuration is D 7.95, php 7.4 and jquery 1.12
Everything was working fine two weeks ago but I don't know what could have caused this issue.

I allow myself to raise the priority if this issue, given the important consequences. Has anyone else experienced the same?

Production build 0.69.0 2024