Skip to content
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

Merged
merged 5 commits into from Jul 23, 2015

Conversation

matthewperry
Copy link

No description provided.

$character_output_count = 0;
$truncated = FALSE;
foreach ($value as $index => $current_value) {
$list_full[] = $current_value;

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']) {

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('...')));
}

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');

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).

adam-vessey added a commit that referenced this pull request Jul 23, 2015
Adding the ability to truncate results based on the field.
@adam-vessey adam-vessey merged commit 03d0044 into Islandora:7.x Jul 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants