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

[EP-tech] Re: Contributors data



Hi Cristian

	You should look into writing a custom renderer.  In the field definition:

		render_value => 'render_contributors_with_contribution',

	...and then in a separate cfg.d file (appropriately named):

		$c->{render_contributors_with_contribution} = sub
		{
			my ($repo, $field, $value) = @_;

			my $xml = $repo->xml;

			my $contributors_str = [];
			foreach my $contributor (@{$value})
			{
					my $str = EPrints::Utils::make_name_string($contributor->{name});
					if ($contributor->{contributor_type})
					{
						my $phrase_name =  "contributor_type_" . $value->{contributor_type};
						$str .= ' [' . $repo->phrase($phrase_name) . ']';
					}
					push @{$contributors_str}, $str;
			}
			return $repo->xml->create_text_node(join('; ',@{$contributors_str});
		}

	Note that I have typed this straight into my email.  It will almost certainly not compile, and once it does it may not work.  You will probably need to do a little debugging.

	Alternatively, you could probably do this with an XML citation style using conditionals and iterators...


--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services




On 2 Mar 2015, at 13:22, Centro de Documentaci?n wrote:

> Hi guys,
> 
> Is it possible to show contributors_name and contributors_type in the
> same row in abstract pages? Something like that:
> 
> Contributors: contributors_name [contributors_type]; contributors_name
> [contributors_type] ...
> 
> Regards,
> 
> Cristian
> *** 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/