[EP-tech] Render_value help
Jean-Marie.Lebechec at inp-toulouse.fr
Jean-Marie.Lebechec at inp-toulouse.fr
Wed Oct 25 07:17:42 BST 2017
Ah yes, thank you. I understood better the mechanism ! It is sometimes
(often) difficult to debug Eprints :-)
Jean-Marie
Le 24/10/2017 à 16:23, Adam Field a écrit :
>
> You need to return a dom object from a render function. Here are a
> couple of replacement lines:
>
> ….
>
> push @authors, /EPrints::Utils::make_name_string( $_->{name} );/
>
> …
>
> return $repo->xml->create_text_node(join(‘; ‘, @authors));
>
> Move the return to the bottom of the function, aswell. At the moment
> it’s in the loop. Also, I think your render_value config line may
> belong outside the fields section.
>
> --
>
> Adam
>
> *From: *<eprints-tech-bounces at ecs.soton.ac.uk> on behalf of
> <Jean-Marie.Lebechec at inp-toulouse.fr>
> *Reply-To: *<eprints-tech at ecs.soton.ac.uk>
> *Date: *Tuesday, 24 October 2017 15:07
> *To: *<eprints-tech at ecs.soton.ac.uk>
> *Subject: *[EP-tech] Render_value help
>
> Hi all,
>
> I want to modify the rendering field creators to add an ID ("ppn") as
> indicated in this page. So I defined in my eprint_field.pl this
> configuration:
>
> /{
> 'name' => 'creators',
> 'type' => 'compound',
> 'allow_null' => 1,
> 'multiple' => 1,
> 'fields' => [
> {
> 'sub_name' => 'ppn',
> 'type' => 'text',
> 'input_cols' => 10,
> 'allow_null' => 1,
> },
> {
> 'sub_name' => 'name',
> 'type' => 'name',
> 'hide_honourific' => 1,
> 'hide_lineage' => 1,
> 'family_first' => 1,
> },
> },
> {
> 'sub_name' => 'id',
> 'type' => 'text',
> 'input_cols' => 20,
> 'allow_null' => 1,
> },
> ],
> 'input_boxes' => 4,
> 'render_value' => 'idref',
> .../
>
> /}/
>
>
> but I can not write the code to display the authors' data in the
> following form:
> "Name, First name (ppn) and Name, First name and Name, First name
> (ppn)" for example.
>
> I started writing things like this:
> /$c->{idref} = sub
> {
>
> my ($repo, $field, $value, $allangs, $nolink, $eprint) = @_;
> my @authors;
>
> for( @{ $eprint->value( "creators" ) } )
> {
>
> push @authors, {
> author => EPrints::Utils::make_name_string( $_->{name} ),
> };
> return \@authors;
> }
>
> }/
>
> but it does not work....
>
> Any help or example will be welcome!
>
> Jean-Marie
>
> --
> ***********************************************
> Jean Marie Le Bechec
> Service Commun de la Documentation
> Responsable ingenierie documentaire
> &
> Direction du Systeme d'Information
> Referent Etudes
> Institut National Polytechnique de Toulouse
> 6 allee Emile Monso - bp 34038 -
> 31029 Toulouse cedex 4
> Tel : 05 34 32 31 16
> Tel Port : 06 40 81 35 68
> Mail :lebechec at inp-toulouse.fr <mailto:lebechec at inp-toulouse.fr>
> ***********************************************
>
> *** Options:
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech ***
> Archive: http://www.eprints.org/tech.php/ *** EPrints community wiki:
> http://wiki.eprints.org/ *** EPrints developers Forum:
> http://forum.eprints.org/
>
>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/
--
***********************************************
Jean Marie Le Bechec
Service Commun de la Documentation
Responsable ingenierie documentaire
&
Direction du Systeme d'Information
Referent Etudes
Institut National Polytechnique de Toulouse
6 allee Emile Monso - bp 34038 -
31029 Toulouse cedex 4
Tel : 05 34 32 31 16
Tel Port : 06 40 81 35 68
Mail : lebechec at inp-toulouse.fr
***********************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20171025/bea938d8/attachment-0001.html
More information about the Eprints-tech
mailing list