<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thanks John &#8211; for some reason on Friday I&#8217;d got it in my head that I needed some sort of superclassing wrapper based on the previous
 replacement mechanism, rather than child classing&#8230;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">By now I must owe you several Guinness (or other beverage of choice) at OR2016!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
<b>On Behalf Of </b>John Salter<br>
<b>Sent:</b> 23 April 2016 07:46<br>
<b>To:</b> eprints-tech@ecs.soton.ac.uk<br>
<b>Subject:</b> Re: [EP-tech] Replace an EPrints Function<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div id="divtagdefaultwrapper">
<p style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">Hi Alan,<o:p></o:p></span></p>
<p style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">Take a look at these instructions:&nbsp;<a href="http://wiki.eprints.org/w/Instructions_for_local_plugins" title="http://wiki.eprints.org/w/Instructions_for_local_plugins
Ctrl&#43;Click or tap to follow the link" id="LPlnk261377">http://wiki.eprints.org/w/Instructions_for_local_plugins</a><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">As you're trying to do something in a plugin, it all works really well (like it was designed for this!).
<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">One addition to the page would be that you could call the method you're overriding if you wanted to:<br>
my $original_rendering =&nbsp;$self-&gt;SUPER::render( $things );<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">$original_rendering-&gt;appendChild( ... );<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;- if you just want to append/prepend extra nodes to the original render.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">Also, when I do this, I normally name the new package e.g.
</span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">EPrints::Plugin::Screen::ArchiveIDItems rather than&nbsp;EPrints::Plugin::Screen::MyItems - makes it easier when you've got multiple archives running.</span><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">Cheers,</span><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">John</span><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<div>
<div class="MsoNormal" align="center" style="text-align:center;background:white">
<span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">
<hr size="2" width="98%" align="center">
</span></div>
<div id="divRplyFwdMsg">
<p class="MsoNormal" style="background:white"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">
<a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">eprints-tech-bounces@ecs.soton.ac.uk</a> &lt;<a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">eprints-tech-bounces@ecs.soton.ac.uk</a>&gt; on behalf of Alan.Stiles &lt;<a href="mailto:alan.stiles@open.ac.uk">alan.stiles@open.ac.uk</a>&gt;<br>
<b>Sent:</b> 22 April 2016 17:01<br>
<b>To:</b> <a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a><br>
<b>Subject:</b> [EP-tech] Replace an EPrints Function</span><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">Hi All,<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">I&#8217;m trying to programmatically amend the EPrints::Plugin::Screen::Items screen.<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">We (one of my predecessors) have already replaced the render function with a local one using
<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">undef &amp;EPrints::Plugin::Screen::Items::render;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">##Define new method and assign to exiting method<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">*EPrints::Plugin::Screen::Items::render = \&amp;local_render;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">So I could just amend the local_render to modify the doc_fragment as necessary whilst it gets built, but I&#8217;d like to do it in a more plugin-friendly way,&nbsp;
 so, intercept the call to render as above, but then actually be able to call the original render function.<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">Thus far I&#8217;ve managed to send the (dev) server into several infinite loops &#8211; any suggestions for how to achieve it, or other suggestions gratefully received!<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">Cheers,<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#44546A">Alan</span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black"><o:p></o:p></span></p>
<p style="background:white"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:black">&nbsp;<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif;color:black">-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England &amp; Wales and a charity registered in Scotland (SC 038302).
 The Open University is authorised and regulated by the Financial Conduct Authority.
<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>