function sarnia_entity_properties_table in Sarnia 7
2 calls to sarnia_entity_properties_table()
- sarnia_entity_properties_form in ./
sarnia.entities.inc - sarnia_schema_rule_form in ./
sarnia.rules.inc - Administration form for rules.
File
- ./
sarnia.entities.inc, line 292
Code
function sarnia_entity_properties_table($server, $fields = NULL) {
if (!isset($fields)) {
$fields = $server
->getRemoteFields();
}
$header = array(
'Property name',
'DynamicBase',
'Type',
'Schema',
'Uses',
);
$rows = array();
$sorts = array(
'bases' => array(),
'names' => array(),
);
$fulltext = $server
->getFulltextFields();
$filter = $server
->getFilterFields();
$sort = $server
->getSortFields();
$display = $server
->getDisplayFields();
foreach ($fields as $name => $field) {
$base = $field
->getDynamicBase();
$row = array();
$row[] = $name;
$row[] = "<code>{$base}</code>";
$row[] = $field
->getType();
$row[] = implode(', ', array_filter(array(
$field
->isIndexed() ? 'indexed' : '',
$field
->isTokenized() ? 'tokenized' : '',
$field
->isStored() ? 'stored' : '',
$field
->isMultivalued() ? 'multivalued' : '',
)));
$row[] = implode(', ', array_filter(array(
isset($fulltext[$name]) ? 'fulltext' : '',
isset($filter[$name]) ? 'filter' : '',
isset($sort[$name]) ? 'sort' : '',
isset($display[$name]) ? 'display' : '',
)));
$rows[$name] = array(
'data' => $row,
);
// Sort by dynamic base, then by name.
$sorts['bases'][$name] = $base;
$sorts['names'][$name] = $name;
}
array_multisort($sorts['bases'], $sorts['names'], $rows);
return array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
);
}