5.7 overriding src/social/servicelist/

Permalink
Hi all,

Should be a straight forward question for someone with more skills than myself... I am trying to change the icons used with the Social Icons block and have found they are contained within \concrete\src\Sharing\SocialNetwork\ServiceList.php.

I can edit this file and the change works however I am trying to follow the correct procedure by not changing the core and only creating overrides however when I move this to the Application directory, the change does not tale affect.

Is there anything special that needs to be done to this file to allow it become an override?

 
mesuva replied on at Permalink Reply
mesuva
It may depend on how much you want to customise the icons, but recently I did a little view override of the Social Links block, so that it wouldn't use the 'square' versions for some of the icons.

I dropped into /application/blocks/social_links/view.php the following code:

<?php
defined('C5_EXECUTE') or die("Access Denied.");
?>
<div id="ccm-block-social-links<?php echo $bID?>" class="ccm-block-social-links">
    <?php foreach($links as $link) {
        $service = $link->getServiceObject();
        ?>
         <a href="<?php echo $link->getURL()?>"><?php echo str_replace('-square', '', $service->getServiceIconHTML())?></a>
    <?php } ?>
</div>

It's really just doing a quick find and replace on the HTML it outputs - arguably a bit hacky, but it was an easy way to achieve what we wanted to do.

So perhaps this is another way to achieve what you are wanting to do.
mobius2000 replied on at Permalink Reply
Nice trick, I like it... This will certainly serve my purpose however I hope someone out there might know how to achieve the override functionality the same way as blocks are overridden.

Thank you mesuva, your change will allow me to progress.
mesuva replied on at Permalink Reply
mesuva
With overriding classes I'm pretty sure nearly everything can be overridden in 5.7, it's just all about the name spacing.

Perhaps have a look at this example I put up on github regarding the SecureimageController class:
https://github.com/concrete5/concrete5-5.7.0/issues/2088...

Take note of the way the namespace has been created and how the class extends the original file. I think it would be the same concept with the ServiceList class (I just haven't tested that specifically).
mobius2000 replied on at Permalink Reply
No luck I'm afraid... I attempted to change the namespace of the original file to
namespace Application\src\Sharing\SocialNetwork;


Thank you for taking the time to respond.
mesuva replied on at Permalink Reply
mesuva
I've had a try myself, I didn't have any luck either.

I tried overriding the other classes in the same directory, plus the block controller, as I'm thinking some of the related classes are hardcoded namespaces. It seems to be a bit of a tangle, not something that could be cleanly overridden in this case.

I'm not sure if that's because I'm just missing something, or if this hasn't been considered for this kind of scenario.

I actually think this list of social links should be more of a config item, rather than in a class.
JohntheFish replied on at Permalink Reply
JohntheFish