Share this page -> open in new window

Permalink 1 user found helpful
Hi guys,

Concrete 5 has a nice 'Share this page' block available that actually let a user post a link on LinkedIn, Twitter etc. with the possibility to add his/hers own message. That's nice, but it doesn't open it's share message in a new window but in the current window, replacing my website. This is odd behavior given the fact that it also resizes the screen (LinkedIn, Twitter).

Is there a way to let this block open it's share message in a new window (like we did in HTML with 'target=blank' added to the link address)?
Your help will be appreciated!

Hans

hhockx
 
ConcreteOwl replied on at Permalink Best Answer Reply
ConcreteOwl
You can over ride this block by copying the share_this_page folder into application/blocks.
Edit the controller namespace to
namespace Application\Block\ShareThisPage;

And edit the view file to this
<?php defined('C5_EXECUTE') or die('Access Denied.'); ?>
<div class="ccm-block-share-this-page">
    <ul class="list-inline">
    <?php foreach ($selected as $service) {
    ?>
        <li><a href="<?php echo h($service->getServiceLink()) ?>" aria-label="<?php echo h($service->getDisplayName()) ?>" target="_blank"><?php echo $service->getServiceIconHTML()?></a></li>
    <?php 
} ?>
    </ul>
</div>

That should do it..
hhockx replied on at Permalink Reply
hhockx
Thank you very much for your help. It works the way I wanted. I've used your code in the footer area ofhttp://www.loopbaanwerkplaats.nl
Steevb replied on at Permalink Reply 1 Attachment
Steevb
Similar to above but in zip form. Unzip attached into your ‘application/blocks folder'.

Then after adding the share block, choose custom template - My Share.

Modify view.php or css to suit.
hhockx replied on at Permalink Reply
hhockx
Hi Steveb,

Also thank you too for your elegant solution using a custom template. I used it on another website of mine, at hanshockx.nl
Wanted to mark your answer also as 'best answer' but Concrete5 doesn't allow me to mark two 'best answers' in one topic...