You are here

function drupalgap_modules_widget in DrupalGap 7

Same name and namespace in other branches
  1. 7.2 drupalgap.module \drupalgap_modules_widget()

Renders the widget to control the module's for the app from the settings page.

1 call to drupalgap_modules_widget()
drupalgap_status in ./drupalgap.pages.inc
Returns the HTML for the DrupalGap module status page.

File

./drupalgap.module, line 503
A module to provide a bridge between Drupal websites and PhoneGap mobile applications.

Code

function drupalgap_modules_widget() {
  if (!variable_get('drupalgap_sdk_installed', 0)) {
    return '';
  }
  $items = array(
    l(t('Browse contrib modules'), 'http://drupalgap.org/project/modules', array(
      'attributes' => array(
        'target' => '_blank',
      ),
    )),
    l(t('Module help'), 'http://drupalgap.org/node/74', array(
      'attributes' => array(
        'target' => '_blank',
      ),
    )),
  );
  $module_install_form = drupal_get_form('drupalgap_module_install_form');
  $html = '<h2>' . t('Modules') . '</h2>' . theme('item_list', array(
    'items' => $items,
  )) . drupal_render($module_install_form);
  $modules = drupalgap_load_modules('contrib');
  if ($modules) {

    //dpm($modules);
    $rows = array();
    foreach ($modules[0] as $delta => $line) {
      $module = $modules[1][$delta];
      $rows[] = array(
        l($module, 'http://drupalgap.org/project/' . check_plain($module), array(
          'attributes' => array(
            'target' => '_blank',
          ),
        )),
      );
    }
    $html .= '<h3>Contrib</h3>' . theme('table', array(
      'rows' => $rows,
    ));
  }
  return $html;
}