The "Force default" is a very powerful feature. It allows you to display any view within a node, without having the user to choose the view. This proves quite useful when you want to create an image gallery, showing all images associated with the given node. To do this, you'd have an image gallery content type and an image content type, using a node reference to the image gallery content types. In the gallery content type, you'd use the view field to display all images associated with the given node using "[nid]" for the arguments with the "Force default" option enabled.

Although it effectively hides which view(s) you can select, it doesn't hide the arguments. When you add a new image gallery content type, you still see the option to change the arguments from "[nid"].

Comments

robloach’s picture

Status: Active » Needs review
StatusFileSize
new1.6 KB

The attached patch will effectively hide all the form fields when Force Default is checked (fieldset, views and arguments).

moshe weitzman’s picture

Status: Needs review » Needs work

you commented out the 'administer users check. i have been thinking of removing that too. please resubmit with that removed. Further, the best way to do this is to not conditionally define the fieldset but rather add a #access property to it. That way, people who form_alter will see the element and can choose to edit accordingly.

thanks for the patch.

robloach’s picture

Status: Needs work » Needs review
StatusFileSize
new1.58 KB
robloach’s picture

Status: Needs review » Needs work

Having #access hides the settings in the ViewField settings page....

robloach’s picture

Status: Needs work » Needs review
StatusFileSize
new1.64 KB

This looks a bit better.

tostinni’s picture

Works fine for me, thanks for the patch.

WISEOZ’s picture

I am on the latest version of Viewfield. I have applied this patch and it has appeared to get rid of some foreach() errors I'd been getting when a Viewfield was included with my node. I'm now seeing the view I'd expect using an argument [nid], but I'm also receiving the following errors on my node that includes a Viewfield:

    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /usr/local/apache2/htdocs/drupal/modules/date/date_api.module on line 501.

Seems these errors appear with any combination of Force Default, Override checkboxes, and a [nid] argument on the Viewfield configure form. A couple weeks ago I had been getting these errors upon upgrading to the dev version of Date module but in other areas of my site (before I ever used Viewfield). When researching, I found that I needed to upgrade to the dev version of Token to get rid of those errors. That worked then, but now I'm seeing these errors again with the use of Viewfield on a node. Is their some deeper conflict with Viewfield, Date, and Token that I'm picking up on with this error?

Keep in mind that I am a Drupal 5.5 with PostgreSQL implementation.

CoolDreamZ’s picture

Thanks for the patch, did exactly what I was looking for (all options hidden on node edit page if force default is set in the viewfield configuration), tested OK.

I have another issue (how to hide the view on a teaser) I will start a new thread for that as I couldn't find anything on this)

Delta Bridges’s picture

Hello there,
Can we have new stable release of this module please ( previous one is from april 2007)?
I first downloaded 5.1.2 and was looking everywhere for this "force default" option, haha!
Many thanks for this very useful module :)
Expat9

looplog’s picture

subscribing

robloach’s picture

Status: Needs review » Reviewed & tested by the community

Numerous reviews of the patch at #5 returned positive. So setting this to RTBC.

darren oh’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in CVS commit 113532.

darren oh’s picture

Version: 5.x-1.x-dev » 5.x-1.2
niklp’s picture

Please roll 1.3 stable then...? Edit: oh you have, sorry! :)

(also token support, grumble...)

moshe weitzman’s picture

he did roll 5.1.3. grumble.

niklp’s picture

bah, too slow... :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

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