function theme_facetapi_realm_settings_table in Facet API 7
Same name and namespace in other branches
- 6.3 facetapi.admin.inc \theme_facetapi_realm_settings_table()
- 7.2 facetapi.admin.inc \theme_facetapi_realm_settings_table()
Returns the realm settings table.
Parameters
$variables: An associative array containing:
- element: A render element representing the form.
1 theme call to theme_facetapi_realm_settings_table()
- facetapi_realm_settings_form in ./
facetapi.admin.inc - Form constructor for the realm settings form.
File
- ./
facetapi.admin.inc, line 231 - Admin page callbacks for the Facet API module.
Code
function theme_facetapi_realm_settings_table($variables) {
$output = '';
// Adds CSS to ensure that the dropbutton looks nice.
$path = drupal_get_path('module', 'facetapi');
drupal_add_css($path . '/facetapi.admin.css', array(
'weight' => CSS_THEME - 1,
));
// Gets variales for code readability.
$searcher = $variables['element']['#facetapi']['adapter']
->getSearcher();
$realm = $variables['element']['#facetapi']['realm'];
$header = array(
'enabled' => array(
'data' => t('Enabled'),
),
'label' => array(
'data' => t('Facet'),
),
'operations' => array(
'data' => t('Operations'),
),
);
if ($realm['sortable']) {
$header['weight'] = array(
'data' => t('Weight'),
);
}
// Builds field options.
$rows = array();
$facet_info = $variables['element']['#facetapi']['facet_info'];
foreach ($facet_info as $facet_name => $facet) {
// Builds rows.
$rows[$facet_name] = array(
'class' => $realm['sortable'] ? array(
'draggable',
) : array(),
'data' => array(
drupal_render($variables['element']['enabled_facets'][$facet_name]),
check_plain($facet['label']) . "<div class='description'>" . filter_xss($facet['description']) . '</div>',
array(
'class' => 'facetapi-operations',
'data' => drupal_render($variables['element']['operations'][$facet_name]),
),
),
);
if ($realm['sortable']) {
$rows[$facet_name]['data'][] = drupal_render($variables['element']['weight'][$facet_name]);
}
}
if ($realm['sortable']) {
drupal_add_tabledrag('facetapi-realm-settings', 'order', 'sibling', 'facetapi-facet-weight');
}
$output .= drupal_render_children($variables['element']);
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'facetapi-realm-settings',
),
));
return $output;
}