<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Ah, it's a compound multiple field.<div><br></div><div>You need to render creators_name, not creators. Also, try putting the render_single_value in the name subfield definition -- I'm not sure if it will work off the top of my head, but it makes sense. I've modified the code below. Let us know if it works.</div><div><br></div><div>I modified eprint_fields.pl:<br>{<br> name => 'creators',<br> type => 'compound',<br> multiple => 1,<br> fields => [<br> {<br> sub_name => 'name',<br> type => 'name',<br> hide_honourific => 1,<br> hide_lineage => 1,<br> family_first => 1,</div><div> render_single_value => 'render_name_with_initials',</div><div> },<br> {<br> sub_name => 'id',<br> type => 'text',<br> input_cols => 20,<br> allow_null => 1,<br> }<br> ],<br> input_boxes => 2,<br>},<br><br>I introduced eprint_render_single.pl:<br>print STDERR "It's Me :)\n";<br>$c->{render_name_with_initials} = sub<br>{<br> print STDERR "It's You :)\n";<br> my( $field, $repo, $value ) = @_;<br> my $family = $value->{family};<br> my $given = $value->{given};<br> return $repo->xml->create_text_node( 'foo' );<br>}<br><br>I used Test.pl<br>#!/usr/bin/perl -I/opt/eprints3/perl_lib<br><br>use strict;<br>use warnings;<br>use EPrints;<br><br>my $ep = EPrints->new;<br>my $repo = $ep->repository('b40literatur');<br><br>my $eprint = $repo->dataset('eprint')->dataobj(3);<br><br>print STDERR EPrints::Utils::tree_to_utf8($eprint->render_value('creators_name'));<br></div><div><br></div><div><br></div><div><br></div><div><br><div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>--<br>Adam Field<br>Business Relationship Manager and Community Lead<br>EPrints Services</div><div><br></div></div></div><br class="Apple-interchange-newline">
</div>
<br><div><div>On 13 Oct 2015, at 15:09, Thomas Lauke <<a href="mailto:th.lauke@arcor.de">th.lauke@arcor.de</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Adam,<br><br>there's obviously something wrong, although I think to follow all your instructions :(<br><br>I modified eprint_fields.pl:<br>{<br> name => 'creators',<br> type => 'compound',<br> multiple => 1,<br> fields => [<br> {<br> sub_name => 'name',<br> type => 'name',<br> hide_honourific => 1,<br> hide_lineage => 1,<br> family_first => 1,<br> },<br> {<br> sub_name => 'id',<br> type => 'text',<br> input_cols => 20,<br> allow_null => 1,<br> }<br> ],<br> render_single_value => 'render_name_with_initials',<br> input_boxes => 2,<br>},<br><br>I introduced eprint_render_single.pl:<br>print STDERR "It's Me :)\n";<br>$c->{render_name_with_initials} = sub<br>{<br> print STDERR "It's You :)\n";<br> my( $field, $repo, $value ) = @_;<br> my $family = $value->{family};<br> my $given = $value->{given};<br> return $repo->xml->create_text_node( 'foo' );<br>}<br><br>I used Test.pl<br>#!/usr/bin/perl -I/opt/eprints3/perl_lib<br><br>use strict;<br>use warnings;<br>use EPrints;<br><br>my $ep = EPrints->new;<br>my $repo = $ep->repository('b40literatur');<br><br>my $eprint = $repo->dataset('eprint')->dataobj(3);<br><br>print STDERR EPrints::Utils::tree_to_utf8($eprint->render_value('creators'));<br><br>But I got finally for perl Test.pl <br>It's Me :)<br>CreatorsEmailFoote, H.W.UNSPECIFIEDLevy, L.H.UNSPECIFIED<br><br>Thus my extra subroutine is never called even after apache's restart and database update?!<br><br>Thanks for any hint<br>Thomas<br>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a><br>*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a><br>*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a><br></blockquote></div><br></div></body></html>