In the settings screen you can now opt to make the gallery selection required. I also added a title to the selection box because when it is required and you select nothing the title field is used to indicate that a selection should be made.

CommentFileSizeAuthor
og_galleries.patch1.6 KBjax

Comments

jax’s picture

Status: Active » Needs review
karens’s picture

I don't really understand this. The gallery selection must be required and cannot be optional. What exactly are you trying to accomplish??

jax’s picture

When creating an image the og_galleries module will display a select box where you can select the gallery to put the image in. By default this select isn't required. You can just submit the image without selecting a gallery. I want to make it required to select a gallery so that it is not possible to submit an image without selecting a gallery.

If that still isn't clear enough I'll submit screenshots to illustrate.

jax’s picture

Here are the screenshots.

This is the default "Create Image" page with og_galleries enabled. Here you see what happens when you click preview. There is only an error on "title" and nothing is mentioned about the gallery.

When you add:

@@ -542,6 +550,8 @@
         '#default_value' => $default,
         '#options' => $options,
         '#multiple' => TRUE,
+        '#title' => 'Galleries',
+        '#required' => TRUE,
         );

The create screen looks like this. Notice the asterisk? When you click preview you get this screen. Now you get an error about not selecting a gallery.

So the patch enables the administrator to make the gallery selection required. I need this for my project that is why I made the patch. If it is not committed I will have to maintain my own branch of the code which isn't fun. Moreover my patch leaves all the defaults as-is so nobody will have trouble because of it.

karens’s picture

Status: Needs review » Fixed

Now that I understand, I agree it's a nice option. Committed to all branches. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)