Score:-2

How can I loop on checkboxes to hide all using mlid: from the datatable?

gb flag
function ts_core_form_menu_overview_form_alter (&$form, &$form_state, $form_id) {
  $form['mlid:11242']['hidden']['#type'] = 'hidden';
  $form['mlid:11246']['hidden']['#type'] = 'hidden';
  $form['mlid:11249']['hidden']['#type'] = 'hidden';
  $form['mlid:11250']['hidden']['#type'] = 'hidden';
  $form['mlid:11252']['hidden']['#type'] = 'hidden';
  $form['mlid:11253']['hidden']['#type'] = 'hidden';
  $form['mlid:11254']['hidden']['#type'] = 'hidden';
  $form['mlid:11255']['hidden']['#type'] = 'hidden';
  $form['mlid:11256']['hidden']['#type'] = 'hidden';
  $form['mlid:11257']['hidden']['#type'] = 'hidden';
  $form['mlid:11258']['hidden']['#type'] = 'hidden';
  $form['mlid:11262']['hidden']['#type'] = 'hidden';
  $form['mlid:11263']['hidden']['#type'] = 'hidden';
  $form['mlid:11264']['hidden']['#type'] = 'hidden';
  $form['mlid:11265']['hidden']['#type'] = 'hidden';
  $form['mlid:11285']['hidden']['#type'] = 'hidden';
  $form['mlid:11286']['hidden']['#type'] = 'hidden';
  $form['mlid:11287']['hidden']['#type'] = 'hidden';
  $form['mlid:11290']['hidden']['#type'] = 'hidden';
  $form['mlid:16459']['hidden']['#type'] = 'hidden';
  $form['mlid:6698']['hidden']['#type'] = 'hidden';
  $form['mlid:11241']['hidden']['#type'] = 'hidden';
  $form['mlid:11267']['hidden']['#type'] = 'hidden';
  $form['mlid:11243']['hidden']['#type'] = 'hidden';
  $form['mlid:16969']['hidden']['#type'] = 'hidden';
}
berliner avatar
bd flag
You can generally loop in every way that PHP provides you with. I think you might want to explain your specific use case (why do you want to hide those checkboxes from the menu overview page, are those the "enabled" checkboxes?) as well as the specific source of that list of mlids that you want to hide. If you want to hide the full column, then you should update your question or ask a new one, as that is an important difference to other users here trying to help you.
Score:0
gb flag

function ts_core_form_menu_overview_form_alter (&$form, &$form_state { $dest = drupal_get_destination(); //call back function to

if ($dest['destination'] == 'homepage_rbf') return; // query string search foreach ($form as $key => $item ) { if (strpos($key, 'mlid') === 0) { $form[$key]['hidden']['#type'] = 'hidden'; } }

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.