summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgit2016-12-22 16:50:06 -0800
committerPat2016-12-22 16:50:06 -0800
commit7c2d3ad569096bac3eeac96838db97cd34176e80 (patch)
treeb215d8fa23016c53d4dd8d75e964d65ea1c4e9f5
parentf7b692e5d6f9bf92d36b3566d5dba10dea9599bc (diff)
Issue #2837846 by rrotari, micropat: Allow custom additional html to be used
-rw-r--r--addtoany.module16
1 files changed, 12 insertions, 4 deletions
diff --git a/addtoany.module b/addtoany.module
index 5b92435..5e6a505 100644
--- a/addtoany.module
+++ b/addtoany.module
@@ -136,13 +136,16 @@ function addtoany_page_attachments(&$page) {
* @param object $node
* The node object to create the buttons for.
*
+ * @param object $config
+ * If present this will be used as custom config data. Use NULL for default config data.
+ *
* @return string
* The HTML code for the buttons.
*/
-function addtoany_create_node_buttons($node) {
+function addtoany_create_node_buttons($node, $config = NULL) {
$url = isset($node) ? $node->url('canonical', array('absolute' => true)) : NULL;
$title = isset($node) ? $node->label() : NULL;
- return addtoany_create_buttons($url, $title);
+ return addtoany_create_buttons($url, $title, $config);
}
/**
@@ -155,13 +158,18 @@ function addtoany_create_node_buttons($node) {
* If present this will be used as the title. Use an empty string for no title
* or NULL to use the current page title.
*
+ * @param object $config
+ * If present this will be used as custom config data. Use NULL for default config data.
+ *
* @return string
* The HTML code for the buttons.
*/
-function addtoany_create_buttons($url = NULL, $title = NULL) {
+function addtoany_create_buttons($url = NULL, $title = NULL, $config = NULL) {
global $base_path;
- $config = \Drupal::config('addtoany.settings');
+ if (is_null($config)) {
+ $config = \Drupal::config('addtoany.settings');
+ }
$additional_html = rtrim($config->get('additional_html'));
$universal_button_placement = $config->get('universal_button_placement');