0

I have installed the Media Gallery module for someone's site to upload fotoalbums with; it's need to add a file size restriction because quite a bit of pictures are coming in.
I can't tell what the exact error is in English; the site's language is Dutch. When I want to edit fields in my Media Gallery content type, I get a message that says the settings are stored in the database, locked and I can't change those settings anymore.

Update: There is a similar issue at Drupal.org; it looks like it isn't possible. Or is it?

7
  • Whats your Question ?
    – niksmac
    Commented Apr 19, 2012 at 8:33
  • I would like to change the settings but I can't
    – Immers
    Commented Apr 19, 2012 at 8:38
  • There is a configuration page for sure. Take a look at tuts here drupalgardens.com/documentation/gallery
    – niksmac
    Commented Apr 19, 2012 at 8:40
  • This is a tutorial for those who want to install and use Media Gallery. What I need is to edit the cck fields of the content type as posed in my question: "But when I want to edit fields in my Media Gallery content type..."
    – Immers
    Commented Apr 19, 2012 at 8:46
  • also the answer drupal.org/node/1202642#comment-5073842
    – niksmac
    Commented Apr 19, 2012 at 9:36

1 Answer 1

0

You can make the 'dirty solution' from the link posted by @NikhilMohan into a more 'clean' one pretty easily:

function MYMODULE_form_media_gallery_node_form_alter(&$form, &$form_state) {
  if (arg(1) == 'add') {
    // Get the language code from the node object. Should be reliable.
    $langcode = $form['#node']->language;

    $form['settings_wrapper']['presentation']['media_gallery_allow_download'][$langcode]['#default_value'] = 0;
  }
}

If you're not comfortable writing a custom module you can easily drop this function into your theme's template.php file instead, but change the name of the function to MYTHEME_form_media_gallery_node_form_alter. Once you clear Drupal's caches the hook will start to be called.

Don't forget that Media Gallery is still in beta so you have to expect a few bugs/missing configuration options. Using hooks to alter the fields you need to is pretty much the only option you have here, without going directly into the database.

1
  • Awesome. So yes it's beta and hasn't been updated since okt2011 so it looks like brave php attempts are needed
    – Immers
    Commented Apr 23, 2012 at 8:42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.