diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 6cf7d3051f3..3e7f5fdb1f1 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -864,21 +864,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (isModEnabled('socialnetworks')) {
- foreach ($socialnetworks as $key => $value) {
- if ($value['active']) {
- print '
';
- print ' | ';
- print '';
- if (!empty($value['icon'])) {
- print '';
- }
- print '';
- print ' | ';
- print '
';
- } elseif (!empty($object->socialnetworks[$key])) {
- print '';
- }
- }
+ showSocialNetwork();
}
// Visibility
@@ -1151,21 +1137,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if (isModEnabled('socialnetworks')) {
- foreach ($socialnetworks as $key => $value) {
- if ($value['active']) {
- print '';
- print ' | ';
- print '';
- if (!empty($value['icon'])) {
- print '';
- }
- print '';
- print ' | ';
- print '
';
- } elseif (!empty($object->socialnetworks[$key])) {
- print '';
- }
- }
+ showSocialNetwork();
}
// Visibility
@@ -1620,6 +1592,55 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
+/**
+ * Show social network part if the module is enabled with hiding functionality
+ *
+ * @return void
+ */
+function showSocialNetwork()
+{
+ global $socialnetworks, $object, $form, $object, $langs;
+ echo '';
+
+ print '| | |
';
+ foreach ($socialnetworks as $key => $value) {
+ if ($value['active']) {
+ print '';
+ print ' | ';
+ print '';
+ if (!empty($value['icon'])) {
+ print '';
+ }
+ print '';
+ print ' | ';
+ print '
';
+ } elseif (!empty($object->socialnetworks[$key])) {
+ print '';
+ }
+ }
+
+ print '';
+}
+
llxFooter();
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 8b5dcd251d2..6ef8d929361 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1663,21 +1663,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Social networks
if (isModEnabled('socialnetworks')) {
- foreach ($socialnetworks as $key => $value) {
- if ($value['active']) {
- print '';
- print ' | ';
- print '';
- if (!empty($value['icon'])) {
- print '';
- }
- print '';
- print ' | ';
- print '
';
- } elseif (!empty($object->socialnetworks[$key])) {
- print '';
- }
- }
+ showSocialNetwork();
}
// Prof ids
@@ -2395,21 +2381,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Social network
if (isModEnabled('socialnetworks')) {
- foreach ($socialnetworks as $key => $value) {
- if ($value['active']) {
- print '';
- print ' | ';
- print '';
- if (!empty($value['icon'])) {
- print '';
- }
- print '';
- print ' | ';
- print '
';
- } elseif (!empty($object->socialnetworks[$key])) {
- print '';
- }
- }
+ showSocialNetwork();
}
// Prof ids
@@ -3326,6 +3298,56 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
}
}
+
+/**
+ * Show social network part if the module is enabled with hiding functionality
+ *
+ * @return void
+ */
+function showSocialNetwork()
+{
+ global $socialnetworks, $object, $form, $object, $langs;
+ echo '';
+
+ print '| | |
';
+ foreach ($socialnetworks as $key => $value) {
+ if ($value['active']) {
+ print '';
+ print ' | ';
+ print '';
+ if (!empty($value['icon'])) {
+ print '';
+ }
+ print '';
+ print ' | ';
+ print '
';
+ } elseif (!empty($object->socialnetworks[$key])) {
+ print '';
+ }
+ }
+
+ print '';
+}
+
// End of page
llxFooter();
$db->close();