[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Render_value help



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
*********************************************** 
*** 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/ 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20171024/f62f7b09/attachment.html