<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.eprints.org/w/index.php?action=history&amp;feed=atom&amp;title=Build_attributes.pl</id>
	<title>Build attributes.pl - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.eprints.org/w/index.php?action=history&amp;feed=atom&amp;title=Build_attributes.pl"/>
	<link rel="alternate" type="text/html" href="https://wiki.eprints.org/w/index.php?title=Build_attributes.pl&amp;action=history"/>
	<updated>2026-05-04T22:12:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.8</generator>
	<entry>
		<id>https://wiki.eprints.org/w/index.php?title=Build_attributes.pl&amp;diff=16388&amp;oldid=prev</id>
		<title>Drn@ecs.soton.ac.uk: Added page</title>
		<link rel="alternate" type="text/html" href="https://wiki.eprints.org/w/index.php?title=Build_attributes.pl&amp;diff=16388&amp;oldid=prev"/>
		<updated>2024-07-17T16:37:30Z</updated>

		<summary type="html">&lt;p&gt;Added page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{dirs}}&lt;br /&gt;
{{cfgd}}&lt;br /&gt;
&lt;br /&gt;
'''build_attributes.pl''' allows for manipulating attributes before elements are created This function is called from perl_lib/EPrints/XML.pm sub create_element if present in configuration.&lt;br /&gt;
&lt;br /&gt;
The examples below will allow for attributes to be manipulated with the following structure:&lt;br /&gt;
# Look for the attribute value in config, i.e. &amp;lt;code&amp;gt;$c&amp;lt;/code&amp;gt;&lt;br /&gt;
# Apply any changes to that specific value i.e. either replace or add to it.&lt;br /&gt;
# If there are multiple attribute values it will cycle through them and repeat the above.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
* A class addition, useful for adding framework css classes&lt;br /&gt;
 push @{$c-&amp;gt;{config_attrs}-&amp;gt;{class}-&amp;gt;{&amp;quot;ep_search_controls&amp;quot;}}, ({ class =&amp;gt; &amp;quot;framework-class&amp;quot;, _change_action =&amp;gt; &amp;quot;replace&amp;quot; });&lt;br /&gt;
* A change to the elements id attribute, useful for overwriting layered css&lt;br /&gt;
 push @{$c-&amp;gt;{config_attrs}-&amp;gt;{id}-&amp;gt;{&amp;quot;ep_id_for_elem&amp;quot;}}, ({ id =&amp;gt; &amp;quot;new_id&amp;quot;, _change_action =&amp;gt; &amp;quot;replace&amp;quot; });&lt;br /&gt;
* Adding a new data attribute, useful for adding in accessibility attributes&lt;br /&gt;
 push @{$c-&amp;gt;{config_attrs}-&amp;gt;{id}-&amp;gt;{&amp;quot;ep_id_for_elem&amp;quot;}}, ({ &amp;quot;data_info&amp;quot; =&amp;gt; &amp;quot;data-info&amp;quot; });&lt;br /&gt;
* Creating a classname based on user account type&lt;br /&gt;
 push @{$c-&amp;gt;{config_attrs}-&amp;gt;{class}-&amp;gt;{&amp;quot;ep_page_thing&amp;quot;}}, ({ class =&amp;gt; sub {&lt;br /&gt;
     my $repo = shift @_;&lt;br /&gt;
     if ( defined $repo-&amp;gt;current_user &amp;amp;&amp;amp; $repo-&amp;gt;current_user-&amp;gt;is_staff )&lt;br /&gt;
     {&lt;br /&gt;
         return &amp;quot;staff-member-class&amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
     else&lt;br /&gt;
     {&lt;br /&gt;
         return &amp;quot;non-staff-class&amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 }, _change_action =&amp;gt; &amp;quot;replace&amp;quot; });&lt;/div&gt;</summary>
		<author><name>Drn@ecs.soton.ac.uk</name></author>
		
	</entry>
</feed>