You are here

function theme_om_maximenu_blocks_attach in OM Maximenu 8

Same name and namespace in other branches
  1. 6 inc/om_maximenu.blocks.inc \theme_om_maximenu_blocks_attach()
  2. 7 inc/om_maximenu.blocks.inc \theme_om_maximenu_blocks_attach()

Implementation of theme_hook()

  • View in table format
1 theme call to theme_om_maximenu_blocks_attach()
om_maximenu_blocks_get in inc/om_maximenu.blocks.inc
Adding Blocks

File

inc/om_maximenu.blocks.inc, line 251
OM Maximenu Blocks.

Code

function theme_om_maximenu_blocks_attach($form) {

  //dsm($form);
  $form = $form['form'];
  $module = $form['module']['#default_value'];
  $output = '';

  //dsm($form['layout']);
  $rows = array();
  foreach ($form['om_blocks'] as $key => $prop) {
    $module_check = explode('__', $key);
    if ($module_check[0] == $module) {
      $row = array();

      // Strips labels
      unset($prop['weight']['#title']);
      unset($prop['weight']['#description']);
      unset($prop['checked']['#title']);
      unset($form['om_blocks'][$key]['weight']);
      unset($form['om_blocks'][$key]['checked']);
      $row[] = array(
        'class' => 'col-block',
        'data' => drupal_render($form['om_blocks'][$key]),
      );
      $row[] = array(
        'class' => 'col-weight',
        'data' => drupal_render($prop['weight']),
      );
      $row[] = array(
        'class' => 'col-checked',
        'data' => drupal_render($prop['checked']),
      );
      $rows[] = array(
        'data' => $row,
        'id' => 'om-row-' . $module . '-' . $key,
      );
    }
  }
  $header = array(
    t('Blocks'),
    t('Weight'),
    t('Enabled'),
  );

  //, 'Update'

  // Header
  $form['form']['#children'] = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'om-maximenu-blocks-' . $module . '-' . $key,
    ),
  ));
  $output .= drupal_render_children($form);
  return $output;
}