extend Social Links (missing icons for bandcamp, email)
I want to use the Social Links block, but I also need icons for "bandcamp" and "email" (opens mailto: link).
The bandcamp service is missing, and after further investigation, it is also missing from font-awesome which is used by concrete 5.7.
Adding services is impossible without modifying core files (Sharing/SocialNetwork/ServiceList) since the list of services is hardcoded as an array. Would have been nice if this list was in the database, so I could extend it easily ;)
Also, getServiceIconHTML(), which is in the core (Service), returns html for the icon based on font-awesome. But I was actually thinking about using icomoon font or even svg...
Probably going to semi-hardcode the social icons in my site now (maybe I'll override the Social Links block)... any other suggestions?
Sure of course in WP or Drupal you can add a module or plugin to provide this, and maybe then you expect it to be perfect. I'm sure C5 will be the same, somebody will develop a "Better Social Links" addon that is extendable or has more items or whatever. For now I'm impressed that they thought of this and decided to make something core that probably fits 95% of use cases. If you're in the other 5% (what on earth is BandCamp!?) then start coding or pledge some money for an addon.
There probably is a way to extend the existing list... even if it doesn't use a DB table... it's in an array you mention, but is there a way to get that array?
I decided to extend this so that the class name was all that came out of the block (instead of the complete fontawesome html) so that I could choose to use the stacked fontawesome html etc.
First you need to extend the SocialNetwork class from the core - found at concrete/src/Sharing/SocialNetwork - extend all files this to your application folder, making sure to update the namespacing, including where other classes are used. To add more icons, put them in the array in ServiceList.php - just be sure to check that you are using a corresponding class from fontawesome.
Then extend the dashboard page, so that you will see any additional icons you add to ServiceList.php - this is found at concrete/controllers/single_page/dashboard/system/basics/social.php - again be sure to modify namespacing.
Next extend the block - updating namespacing and also the namespacing where you are using the classes you extended above. This is because controller.php calls all the core classes we have already modified.
If you're not already comfortable with extending the core then that might be over your head - but the above works and is the correct way to modify the core so that it's safe for updates.
it showed the changes I made to the list and I added the new social links but when I add the block I get this error "Call to a member function getName() on null ", do you have any idea why ?, thank you so much this method looks wonderful
git hub is now vimeo
The following tutorial describes adding new social links using a config file. I believe this approach is simpler and less error prone than approaches described in this thread.