You are here

function theme_crumbs_weights_expansible in Crumbs, the Breadcrumbs suite 7.2

Theme callback for form elements with "#type" = "crumbs_weights_expansible".

Parameters

array &$vars:

Return value

string Rendered HTML

1 theme call to theme_crumbs_weights_expansible()
crumbs_element_info in ./crumbs.form.inc
Implements hook_element_info()

File

admin/crumbs.expansible.inc, line 10

Code

function theme_crumbs_weights_expansible(&$vars) {
  $element = $vars['element'];
  $rows = array();
  foreach (element_children($element) as $key) {
    $cells = array();
    $cells[] = $key;
    $cells[] = render($element[$key]);

    /** @var crumbs_Container_MultiWildcardDataOffset $meta */
    $meta = $element[$key]['#crumbs_rule_info'];
    $methods = array();
    $routes = array();
    if (is_array($meta->routeMethods)) {
      foreach ($meta->routeMethods as $method => $method_routes) {
        foreach ($method_routes as $route => $method_with_suffix) {
          $methods[] = $method . '()';
          $routes[] = $route;
        }
      }
    }
    if (is_array($meta->basicMethods)) {
      foreach ($meta->basicMethods as $method) {
        $methods[] = $method . '()';
        $routes[] = '-';
      }
    }
    $cells[] = '<code class="crumbs-admin-meta">' . implode('<br/>', $methods) . '</code>';
    $cells[] = '<code class="crumbs-admin-meta">' . implode('<br/>', $routes) . '</code>';
    if ($descriptions = $meta->descriptions) {
      $cells[] = '<div class="crumbs-admin-meta">' . implode('<br/>', $descriptions) . '</div>';
    }
    else {
      $cells[] = '';
    }
    $rows[] = $cells;
  }
  return theme('table', array(
    'rows' => $rows,
    'attributes' => array(
      'id' => 'crumbs_weights_expansible',
    ),
  ));
}