New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the ability to truncate results based on the field. #233
Adding the ability to truncate results based on the field. #233
Conversation
$character_output_count = 0; | ||
$truncated = FALSE; | ||
foreach ($value as $index => $current_value) { | ||
$list_full[] = $current_value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$list_full
will be equal to $value
directly after this loop, yeah? Why not just assign it?
elseif ($character_output_count + strlen($current_value) > $truncate_length[$field]['maximum_length'] && !$truncated) { | ||
$truncation_length = $truncate_length[$field]['maximum_length'] - $character_output_count; | ||
// Force the display of the full ellipsis. | ||
if ($truncation_length < strlen(t('...')) && $truncate_length[$field]['add_ellipsis']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not overly concerned... this block could be more succinctly written as:
if ($truncate_length[$field]['add_ellipsis']) {
$truncation_length = max($truncation_length, drupal_strlen(t('...')));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also... Should the description of the "maximum_length" bit be updated to say that it may be exceeded by the length of the ellipsis string?
*/ | ||
function islandora_solr_truncate_field_display($display_values, $max_length, $add_ellipsis, $word_safe, $wordsafe_length, $separator) { | ||
if (count($display_values) > 0) { | ||
$mod_path = drupal_get_path('module', 'islandora_solr_metadata'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed this last pass: Should move the JS into this module. (since islandora_solr_metadata
is already dependent on islandora_solr
... Don't want to introduce circular dependencies).
Adding the ability to truncate results based on the field.
No description provided.