You are here

function opigno_og_access_form_alter in Opigno 7

File

modules/opigno_og_access/opigno_og_access.module, line 1195
Enable access control for private and public groups and group content.

Code

function opigno_og_access_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == "course_node_form" || $form_id == "class_node_form") {
    if (isset($form['#node_edit_form']) && $form['#node_edit_form'] == TRUE) {

      /// Hide the og roles permissions and set them to overwrite always /////////////////////
      $form['og_roles_permissions'][LANGUAGE_NONE]['#default_value'][0] = 1;
      $form['og_roles_permissions'][LANGUAGE_NONE]['#type'] = 'hidden';

      ////////////////////////////////////////////////////////////////////////////////////////

      // Hide fields ///////////////////////////////////////////////////////////
      $form['catalogue_visibility'][LANGUAGE_NONE]['#type'] = 'hidden';

      ///////////////////////////////////////////////////////////////////////////////////////
      $form['#submit'][] = 'opigno_og_access_form_submit_alter';
      $form['#attached']['js'] = array(
        drupal_get_path('module', 'opigno_og_access') . '/js/opigno_og_access.js',
      );
    }
  }
}