Commit 94b7159f authored by M Parker's avatar M Parker

Improve formatter settings summary.

parent bd3ffe04
......@@ -154,28 +154,60 @@ function d3_sankey_table_group_pp_field_formatter_settings_summary($field, $inst
$summary = '';
if ($display['type'] === 'tablefield_d3_sankey_table_group_pp') {
// Display data about the chart.
$summary .= t('%sankeyType sankey diagram having a width of %width, height of %height, and %iterations iterations.', array(
'%sankeyType' => (string) $sankey_types[$settings['sankeyType']],
'%width' => (string) $settings['width'],
'%height' => (string) $settings['height'],
'%iterations' => (string) $settings['iterations'],
));
// Display data about nodes.
if ((bool) $settings['spread'] === TRUE) {
$summary .= t('%sankeyType sankey diagram having a width of %width, height of %height, and %iterations iterations. Nodes in the diagram have a width of %nodeWidth, a padding of %nodePadding, and are spread across the full height of the chart. Node labels are aligned %alignLabel.', array(
'%sankeyType' => (string) $sankey_types[$settings['sankeyType']],
'%width' => (string) $settings['width'],
'%height' => (string) $settings['height'],
'%iterations' => (string) $settings['iterations'],
$summary .= ' ' . t('Nodes in the diagram have a width of %nodeWidth, a padding of %nodePadding, and are spread across the full height of the chart.', array(
'%nodeWidth' => (string) $settings['nodeWidth'],
'%nodePadding' => (string) $settings['nodePadding'],
'%alignLabel' => (string) $align_label_types[$settings['alignLabel']],
));
}
else {
$summary .= t('%sankeyType sankey diagram having a width of %width, height of %height, and %iterations iterations.; Nodes in the diagram have a width of %nodeWidth, a padding of %nodePadding, and are clustered at the top of the chart. Node labels are aligned %alignLabel.', array(
'%sankeyType' => (string) $sankey_types[$settings['sankeyType']],
'%width' => (string) $settings['width'],
'%height' => (string) $settings['height'],
'%iterations' => (string) $settings['iterations'],
$summary .= ' ' . t('Nodes in the diagram have a width of %nodeWidth, a padding of %nodePadding, and are clustered at the top of the chart.', array(
'%nodeWidth' => (string) $settings['nodeWidth'],
'%nodePadding' => (string) $settings['nodePadding'],
'%alignLabel' => (string) $align_label_types[$settings['alignLabel']],
));
}
// Display data about node colors.
$node_colors = _d3_sankey_explode_csv_nsv_list($settings['node_colors']);
$num_node_colors = count($node_colors);
if ($num_node_colors <= 0) {
$summary .= ' ' . t('The Sankey library will choose node colors.');
}
else {
$summary .= ' ' . format_plural($num_node_colors,
'All nodes will be the same color, %colors.',
'Nodes will be colored automatically from the following list of colors: %colors.', array(
'%colors' => implode(', ', $node_colors),
));
}
// Display data about labels.
$summary .= ' ' . t('Node labels are aligned %alignLabel.', array(
'%alignLabel' => (string) $align_label_types[$settings['alignLabel']],
));
// Display data about link colors.
$link_colors = _d3_sankey_explode_csv_nsv_list($settings['link_colors']);
$num_link_colors = count($link_colors);
if ($num_link_colors <= 0) {
$summary .= ' ' . t('The Sankey library will choose link colors.');
}
else {
$summary .= ' ' . format_plural($num_link_colors,
'All links will be the same color, %colors.',
'Links will be colored automatically from the following list of colors: %colors.', array(
'%colors' => implode(', ', $link_colors),
));
}
}
return $summary;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment