0

I'm working on a publication management site and need a multivalue field collection (which contains several file upload fields). Our authors can upload multiple versions of their publication but only after reviewers (or managers) allow it. Basically I would like to hide the "add another item" button and show if certain conditions are met.

0

1 Answer 1

0

Just place this in a custom module replacing what is given in CAPITAL letters:

function my_module_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'CONTENT_TYPE_node_form') {
    if (CONDITIONS) {
      unset($form['field_files_collection'][LANGUAGE_NONE]['add_more']);
    }

  }
}
2
  • Thanks, I think it'd be a good 'wireframe' solution for my problem. However, the 'CONDITIONS' is the tricky part (for me): In this case the condition would be a workflow state of a referenced node.
    – StG
    Commented Apr 3, 2018 at 9:43
  • Well, your question contained not more than if certain conditions are met, so please accept my answer if it is right as the principle approach and work through your conditions further. Or edit your question and provide detailed information on condition part, so your question would become answerable.
    – AltaGrade
    Commented Apr 3, 2018 at 14:39

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