diff --git a/README.txt b/README.txt
index dd6aeee..4fc242d 100644
--- a/README.txt
+++ b/README.txt
@@ -1,5 +1,6 @@
CONTENTS OF THIS FILE
---------------------
+
* Introduction
* Requirements
* Installation
@@ -8,7 +9,7 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Sharethis module provides social bookmarking utility on selected node types.
+The Sharethis module provides the social bookmarking utility on selected node types.
REQUIREMENTS
------------
diff --git a/js/sharethis.form.js b/js/sharethis.form.js
index 53a7132..ab80166 100644
--- a/js/sharethis.form.js
+++ b/js/sharethis.form.js
@@ -3,70 +3,74 @@
* This file contains most of the code for the configuration page.
*/
-(function ($, window, drupalSettings, stlib_picker) {
- /*global drupal_st;*/
-
+(function ($, window) {
+ /*global drupal_st;*/
+ /*global _all_services;*/
+ /*global stlib_picke;*/
'use strict';
// Create the drupal ShareThis object for clean code and namespacing:
window.drupal_st = {
// These are handlerd for updating the widget pic class.
multiW: function () {
- $('.st_widgetPic').addClass('st_multi');
+ $(".st_widgetPic").addClass("st_multi");
},
classicW: function () {
- $('.st_widgetPic').removeClass('st_multi');
+ $(".st_widgetPic").removeClass("st_multi");
},
// These are the handlers for updating the button pic class (stbc = sharethisbuttonclass).
smallChicklet: function () {
drupal_st.removeButtonClasses();
- $('#stb_sprite').addClass('stbc_');
+ $("#stb_sprite").addClass("stbc_");
},
largeChicklet: function () {
drupal_st.removeButtonClasses();
- $('#stb_sprite').addClass('stbc_large');
+ $("#stb_sprite").addClass("stbc_large");
},
hcount: function () {
drupal_st.removeButtonClasses();
- $('#stb_sprite').addClass('stbc_hcount');
+ $("#stb_sprite").addClass("stbc_hcount");
},
vcount: function () {
drupal_st.removeButtonClasses();
- $('#stb_sprite').addClass('stbc_vcount');
+ $("#stb_sprite").addClass("stbc_vcount");
},
button: function () {
drupal_st.removeButtonClasses();
- $('#stb_sprite').addClass('stbc_button');
+ $("#stb_sprite").addClass("stbc_button");
},
// This is a helper function for updating button pictures.
removeButtonClasses: function () {
- var toRemove = $('#stb_sprite');
- toRemove.removeClass('stbc_');
- toRemove.removeClass('stbc_large');
- toRemove.removeClass('stbc_hcount');
- toRemove.removeClass('stbc_vcount');
- toRemove.removeClass('stbc_button');
+ var toRemove = $("#stb_sprite");
+ toRemove.removeClass("stbc_");
+ toRemove.removeClass("stbc_large");
+ toRemove.removeClass("stbc_hcount");
+ toRemove.removeClass("stbc_vcount");
+ toRemove.removeClass("stbc_button");
},
// Write helper functions for saving:
getWidget: function () {
- return $('.st_widgetPic').hasClass('st_multiW') ? '5x' : '4x';
+ return $(".st_widgetPic").hasClass("st_multiW") ? '5x' : '4x';
},
getButtons: function () {
var selectedButton = 'large';
- var buttonButtons = $('.st_wIm');
+ var buttonButtons = $(".st_wIm");
buttonButtons.each(function () {
- if ($(this).hasClass('st_select')) {
- selectedButton = $(this).attr('id').substring(3);
+ if ($(this).hasClass("st_select")) {
+ selectedButton = $(this).attr("id").substring(3);
}
});
+ console.log(selectedButton);
return selectedButton;
},
setupServiceText: function () {
- $('#edit-service-option').css({display: 'none'});
+ $("#edit-service-option").css({display: "none"});
- if ($('input[name=sharethis_callesi]').val() === 1) {
+ if ($('input[name=sharethis_callesi]').val() == 1) {
drupal_st.getGlobalCNSConfig();
}
+ else {
+ }
},
odjs: function (scriptSrc, callBack) {
this.head = document.getElementsByTagName('head')[0];
@@ -76,7 +80,7 @@
this.script.setAttribute('src', this.scriptSrc);
this.script.onload = callBack;
this.script.onreadystatechange = function () {
- if (this.readyState === 'complete' || (scriptSrc.indexOf('checkOAuth.esi') !== -1 && this.readyState === 'loaded')) {
+ if (this.readyState == "complete" || (scriptSrc.indexOf("checkOAuth.esi") != -1 && this.readyState == "loaded")) {
callBack();
}
};
@@ -84,7 +88,7 @@
},
getGlobalCNSConfig: function () {
try {
- drupal_st.odjs((document.location.protocol === 'https:') ? 'https://wd-edge.sharethis.com/button/getDefault.esi?cb=drupal_st.cnsCallback' : 'http://wd-edge.sharethis.com/button/getDefault.esi?cb=drupal_st.cnsCallback');
+ drupal_st.odjs((("https:" == document.location.protocol) ? "https://wd-edge.sharethis.com/button/getDefault.esi?cb=drupal_st.cnsCallback" : "http://wd-edge.sharethis.com/button/getDefault.esi?cb=drupal_st.cnsCallback"));
}
catch (err) {
drupal_st.cnsCallback(err);
@@ -95,36 +99,36 @@
},
// Function to add various events to our html form elements.
addEvents: function () {
- $('#edit-widget-option-st-multi').click(drupal_st.multiW);
- $('#edit-widget-option-st-direct').click(drupal_st.classicW);
+ $("#edit-widget-option-st-multi").click(drupal_st.multiW);
+ $("#edit-widget-option-st-direct").click(drupal_st.classicW);
- $('#edit-button-option-stbc-').click(drupal_st.smallChicklet);
- $('#edit-button-option-stbc-large').click(drupal_st.largeChicklet);
- $('#edit-button-option-stbc-hcount').click(drupal_st.hcount);
- $('#edit-button-option-stbc-vcount').click(drupal_st.vcount);
- $('#edit-button-option-stbc-button').click(drupal_st.button);
+ $("#edit-button-option-stbc-").click(drupal_st.smallChicklet);
+ $("#edit-button-option-stbc-large").click(drupal_st.largeChicklet);
+ $("#edit-button-option-stbc-hcount").click(drupal_st.hcount);
+ $("#edit-button-option-stbc-vcount").click(drupal_st.vcount);
+ $("#edit-button-option-stbc-button").click(drupal_st.button);
- $('.st_formButtonSave').click(drupal_st.updateOptions);
+ $(".st_formButtonSave").click(drupal_st.updateOptions);
$('#st_cns_settings').find('input').on('click', drupal_st.updateDoNotHash);
},
serviceCallback: function () {
- var services = stlib_picker.getServices('myPicker');
- var outputString = '';
+ var services = stlib_picker.getServices("myPicker");
+ var outputString = "";
for (var i = 0; i < services.length; i++) {
- outputString += '\'' + _all_services[services[i]].title + ':';
- outputString += services[i] + '\',';
+ outputString += "\"" + _all_services[services[i]].title + ":"
+ outputString += services[i] + "\","
}
outputString = outputString.substring(0, outputString.length - 1);
- $('#edit-service-option').attr('value', outputString);
+ $("#edit-service-option").attr("value", outputString);
},
to_boolean: function (str) {
return str === true || $.trim(str).toLowerCase() === 'true';
},
cnsCallback: function (response) {
- if ((response instanceof Error) || (response === '' || (typeof response == 'undefined'))) {
+ if ((response instanceof Error) || (response == "" || (typeof(response) == "undefined"))) {
// Setting default config.
- response = "{'doNotHash': true, 'doNotCopy': true, 'hashAddressBar': false}";
+ response = '{"doNotHash": true, "doNotCopy": true, "hashAddressBar": false}';
response = $.parseJSON(response);
}
@@ -134,34 +138,32 @@
hashAddressBar: drupal_st.to_boolean(response.hashAddressBar)
};
- if (obj.doNotHash === false || obj.doNotHash === false) {
- if (obj.doNotCopy === true || obj.doNotCopy === true) {
- $($('#st_cns_settings').find('input')[0]).removeAttr('checked');
+ if (obj.doNotHash == false || obj.doNotHash === "false") {
+ if (obj.doNotCopy === true || obj.doNotCopy == "true") {
+ $($('#st_cns_settings').find('input')[0]).removeAttr("checked");
}
else {
- $($('#st_cns_settings').find('input')[0]).attr('checked', true);
+ $($('#st_cns_settings').find('input')[0]).attr("checked", true);
}
- if (obj.hashAddressBar === true || obj.hashAddressBar === true) {
- $($('#st_cns_settings').find('input')[1]).attr('checked', true);
+ if (obj.hashAddressBar === true || obj.hashAddressBar == "true") {
+ $($('#st_cns_settings').find('input')[1]).attr("checked", true);
}
else {
- $($('#st_cns_settings').find('input')[1]).removeAttr('checked');
+ $($('#st_cns_settings').find('input')[1]).removeAttr("checked");
}
}
else {
$('#st_cns_settings').find('input').each(function (index) {
- $(this).removeAttr('checked');
+ $(this).removeAttr("checked");
});
}
}
};
- Drupal.behaviors.shareThisForm = {
- attach: function (context) {
- stlib_picker.setupPicker(jQuery('#myPicker'), drupalSettings.sharethis.service_string_markup, drupal_st.serviceCallback);
- drupal_st.addEvents();
- drupal_st.setupServiceText();
- }
- };
+ $(document).ready(function(){
+ stlib_picker.setupPicker(jQuery("#myPicker"), drupalSettings.sharethis.service_string_markup, drupal_st.serviceCallback);
+ drupal_st.addEvents();
+ drupal_st.setupServiceText();
-})(jQuery, window, drupalSettings, stlib_picker);
+ });
+})(jQuery, window);
diff --git a/js/sharethis.js b/js/sharethis.js
index 3f7b8b1..d8556a2 100644
--- a/js/sharethis.js
+++ b/js/sharethis.js
@@ -4,12 +4,13 @@
*/
(function ($, drupalSettings) {
- 'use strict';
- Drupal.behaviors.shareThis = {
- attach: function (context) {
- if (typeof stLight !== 'undefined') {
- stLight.options(drupalSettings.sharethis);
+ /*global stLight;*/
+ 'use strict';
+ $(document).ready(function(){
+ var switchTo5x = true;var __st_loadLate = true;
+ if (stLight !== undefined) {
+ stLight.options(drupalSettings.sharethis);
}
- }
- };
+
+ });
})(jQuery, drupalSettings);
diff --git a/js/stlib_picker.js b/js/stlib_picker.js
index 8b507c9..9593dab 100644
--- a/js/stlib_picker.js
+++ b/js/stlib_picker.js
@@ -8,133 +8,128 @@
// Styling can be found in stlib_picker.css and should be linked in the page.
// To get selected services as an array of strings: (ie ["twitter", "sharethis", "facebook"] )
// Call: var answer = stlib_picker.pickerList[uniqueID]["getServices"]();.
-(function ($, drupalSettings) {
- 'use strict';
+/*global _all_services;*/
+var stlib_picker = {}, isSecure = ("https:" == document.location.protocol) ? true : false;
+stlib_picker.pickerList = [];
+stlib_picker.defaultServices = ["sharethis", "tumblr", "bebo"];
+stlib_picker.getServices = function (id) {
+ var func = stlib_picker.pickerList[id]["getServices"];
+ return func();
+}
- var stlib_picker = {};
- var isSecure = (document.location.protocol === 'https:') ? true : false;
- stlib_picker.pickerList = [];
- stlib_picker.defaultServices = ['sharethis', 'tumblr', 'bebo'];
- stlib_picker.getServices = function (id) {
- var func = stlib_picker.pickerList[id]['getServices'];
- return func();
+// Creates the picker - make sure it has a unique ID.
+stlib_picker.setupPicker = function(jQElement, newDefaults, callback) {
+ console.log("setting up picker");
+ console.log(jQElement);
+ // Make an array to store any needed options.
+ var optionsArray = [];
+ optionsArray["El"] = jQElement;
+ optionsArray["isSelect"] = false;
+ optionsArray["getServices"] = function() {
+ var answer = [];
+ var lis = jQElement.children(".stp_pickerLeft").find(".stp_li");
+ lis.each(function() {
+ answer.push(jQuery(this).attr("id").substring(6));
+ });
+ return answer;
};
- // Creates the picker - make sure it has a unique ID.
- stlib_picker.setupPicker = function (jQElement, newDefaults, callback) {
+ // Append the three divs that are needed:
+ jQElement.append("
");
+ jQElement.append("" +
+ "
" +
+ "
" +
+ "
" +
+ "
");
+ jQElement.append("");
+ jQElement.append("");
- // Make an array to store any needed options.
- var optionsArray = [];
- optionsArray['El'] = jQElement;
- optionsArray['isSelect'] = false;
- optionsArray['getServices'] = function () {
- var answer = [];
- var lis = jQElement.children('.stp_pickerLeft').find('.stp_li');
- lis.each(function () {
- answer.push($(this).attr('id').substring(6));
- });
- return answer;
- };
+ // Add default Services.
+ var pickerDefaults = [];
+ if (newDefaults) {
+ pickerDefaults = newDefaults;
+ }
+ else {
+ pickerDefaults = stlib_picker.defaultServices;
+ }
- // Append the three divs that are needed:
- jQElement.append("");
- jQElement.append("" +
- "
" +
- "
" +
- "
" +
- "
" +
- '
');
- jQElement.append("");
- jQElement.append("");
+ // Add all the services to the picker:
+ jQuery.each(_all_services, function(key, value) {
+ if (jQuery.inArray(key, pickerDefaults) == -1) {
+ var ul = jQElement.children(".stp_pickerRight").children(".stp_ulRight");
+ if (isSecure) {
+ ul.append("
" + value.title + "");
+ }
+ else {
+ ul.append("
" + value.title + "");
+ }
- // Add default Services.
- var pickerDefaults = [];
- if (newDefaults) {
- pickerDefaults = newDefaults;
+ }
+ });
+ for (i = 0; i < pickerDefaults.length; i++) {
+ var ul = jQElement.children(".stp_pickerLeft").children(".stp_ulLeft");
+ if (isSecure) {
+ ul.append("
" + _all_services[pickerDefaults[i]].title + "");
}
else {
- pickerDefaults = stlib_picker.defaultServices;
+ ul.append("
" + _all_services[pickerDefaults[i]].title + "");
}
+ }
- // Add all the services to the picker:
- $.each(_all_services, function (key, value) {
- if ($.inArray(key, pickerDefaults) === -1) {
- var ul = jQElement.children('.stp_pickerRight').children('.stp_ulRight');
- if (isSecure) {
- ul.append('
' + value.title + '');
- }
- else {
- ul.append('
' + value.title + '');
- }
+ // Add the various Event handlers
+ // Need to make sure that we don't get confused when there are multiple pickers.
+ jQElement.find(".stp_li").click(function() {
+ jQElement.find(".stp_select").removeClass("stp_select");
+ jQuery(this).addClass("stp_select");
+ stlib_picker.pickerList[jQElement.attr("id")]["isSelect"] = true;
+ });
+ var arrowDiv = jQElement.children(".stp_pickerArrow").children(".stp_arrow");
+ arrowDiv.children(".stp_up").click(function() {
+ if (stlib_picker.pickerList[jQElement.attr("id")]["isSelect"]) {
+ var li = jQElement.find(".stp_select");
+ var prev = li.prev();
+ if (prev.length != 0) {
+ prev.before(li);
}
- });
- for (var i = 0; i < pickerDefaults.length; i++) {
- var ul = jQElement.children('.stp_pickerLeft').children('.stp_ulLeft');
- if (isSecure) {
- ul.append('
' + _all_services[pickerDefaults[i]].title + '');
- }
- else {
- ul.append('
' + _all_services[pickerDefaults[i]].title + '');
+ if (callback) {
+ callback();
}
}
-
- // Add the various Event handlers
- // Need to make sure that we don't get confused when there are multiple pickers.
- jQElement.find('.stp_li').click(function () {
- jQElement.find('.stp_select').removeClass('stp_select');
- $(this).addClass('stp_select');
- stlib_picker.pickerList[jQElement.attr('id')]['isSelect'] = true;
- });
-
- var arrowDiv = jQElement.children('.stp_pickerArrow').children('.stp_arrow');
- arrowDiv.children('.stp_up').click(function () {
- if (stlib_picker.pickerList[jQElement.attr('id')]['isSelect']) {
- var li = jQElement.find('.stp_select');
- var prev = li.prev();
- if (prev.length !== 0) {
- prev.before(li);
- }
- if (callback) {
- callback();
- }
+ });
+ arrowDiv.children(".stp_left").click(function() {
+ if (stlib_picker.pickerList[jQElement.attr("id")]["isSelect"]) {
+ var li = jQElement.find(".stp_select");
+ var ul = jQElement.children(".stp_pickerLeft").children(".stp_ulLeft");
+ ul.prepend(li);
+ if (callback) {
+ callback();
}
- });
- arrowDiv.children('.stp_left').click(function () {
- if (stlib_picker.pickerList[jQElement.attr('id')]['isSelect']) {
- var li = jQElement.find('.stp_select');
- var ul = jQElement.children('.stp_pickerLeft').children('.stp_ulLeft');
- ul.prepend(li);
- if (callback) {
- callback();
- }
+ }
+ });
+ arrowDiv.children(".stp_right").click(function() {
+ if (stlib_picker.pickerList[jQElement.attr("id")]["isSelect"]) {
+ var li = jQElement.find(".stp_select");
+ var ul = jQElement.children(".stp_pickerRight").children(".stp_ulRight");
+ ul.prepend(li);
+ if (callback) {
+ callback();
}
- });
- arrowDiv.children('.stp_right').click(function () {
- if (stlib_picker.pickerList[jQElement.attr('id')]['isSelect']) {
- var li = jQElement.find('.stp_select');
- var ul = jQElement.children('.stp_pickerRight').children('.stp_ulRight');
- ul.prepend(li);
- if (callback) {
- callback();
- }
+ }
+ });
+ arrowDiv.children(".stp_down").click(function() {
+ if (stlib_picker.pickerList[jQElement.attr("id")]["isSelect"]) {
+ var li = jQElement.find(".stp_select");
+ var next = li.next();
+ if (next.length != 0) {
+ next.after(li);
}
- });
- arrowDiv.children('.stp_down').click(function () {
- if (stlib_picker.pickerList[jQElement.attr('id')]['isSelect']) {
- var li = jQElement.find('.stp_select');
- var next = li.next();
- if (next.length !== 0) {
- next.after(li);
- }
- if (callback) {
- callback();
- }
+ if (callback) {
+ callback();
}
- });
-
- // Save the options (and the picker) globally.
- stlib_picker.pickerList[jQElement.attr('id')] = optionsArray;
- };
+ }
+ });
-})(jQuery, drupalSettings);
+ // Save the options (and the picker) globally.
+ stlib_picker.pickerList[jQElement.attr("id")] = optionsArray;
+}
diff --git a/sharethis.module b/sharethis.module
index 718e126..420b813 100644
--- a/sharethis.module
+++ b/sharethis.module
@@ -160,7 +160,7 @@ function sharethis_node_view(array &$build, EntityInterface $node, EntityViewDis
'#attributes' => array(
'class' => array('links', 'inline'),
),
- // Wrap it in a div.
+ // Wrap it in a div.
'#tag' => 'div',
'#type' => 'html_tag',
'#weight' => 10,
@@ -179,7 +179,9 @@ function sharethis_comment_view(array &$build, EntityInterface $comment, EntityV
if ($sharethis_settings->get('comments') == 1) {
$st_js = $sharethis_manager->sharethisIncludeJs();
$data_options = $sharethis_manager->getOptions();
- $current_path = \Drupal::routeMatch()->getRouteName() ? Url::fromRouteMatch(\Drupal::routeMatch())->getInternalPath() : '';
+ $current_path = \Drupal::routeMatch()
+ ->getRouteName() ? Url::fromRouteMatch(\Drupal::routeMatch())
+ ->getInternalPath() : '';
$path = isset($current_path) ? $current_path : '';
global $base_url;
$path_obj = Url::fromUri($base_url . '/' . $path,
@@ -191,7 +193,8 @@ function sharethis_comment_view(array &$build, EntityInterface $comment, EntityV
$path = $path_obj->toString();
$request = \Drupal::request();
$route_match = \Drupal::routeMatch();
- $title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
+ $title = \Drupal::service('title_resolver')
+ ->getTitle($request, $route_match->getRouteObject());
$content = $sharethis_manager->renderSpans($data_options, $title, $path);
$build['sharethis_comments'] = array(
'#theme' => 'sharethis_block',
diff --git a/src/Form/SharethisConfigurationForm.php b/src/Form/SharethisConfigurationForm.php
index 4c35f28..f834d42 100644
--- a/src/Form/SharethisConfigurationForm.php
+++ b/src/Form/SharethisConfigurationForm.php
@@ -107,7 +107,7 @@ class SharethisConfigurationForm extends ConfigFormBase {
// Create the variables related to services chosen.
$service_string = $current_options_array['services'];
$service_string_markup = "";
- foreach (explode(",", $service_string) as $string) {
+ foreach (explode(",", $service_string) as $name => $string) {
$key = explode(":", Unicode::substr($string, 0, -1));
$key = $key[1];
$service_string_markup[] = $key;
@@ -203,8 +203,7 @@ class SharethisConfigurationForm extends ConfigFormBase {
$form['context']['block']['#children'] = 'You must choose which region to display the in from the Blocks administration';
$entity_bundles = $this->entityManager->getBundleInfo('node');
// Add checkboxes for each view mode of each bundle.
- $entity_modes = $this->entityManager->getViewModes('node');
-
+ $entity_modes = $this->entityManager->getViewModes('node');;
$modes = array();
foreach ($entity_modes as $mode => $mode_info) {
$modes[$mode] = $mode_info['label'];
@@ -402,7 +401,8 @@ class SharethisConfigurationForm extends ConfigFormBase {
->save();
if (is_array($entity_types)) {
foreach ($entity_types as $key => $entity_type) {
- $config->set('sharethisnodes.' . $key, $values[$key . '_options'])->save();
+ $config->set('sharethisnodes.' . $key, $values[$key . '_options'])
+ ->save();
}
}
parent::submitForm($form, $form_state);
diff --git a/src/SharethisManager.php b/src/SharethisManager.php
index de8e7d8..f173901 100644
--- a/src/SharethisManager.php
+++ b/src/SharethisManager.php
@@ -77,6 +77,7 @@ class SharethisManager implements SharethisManagerInterface {
];
}
+
/**
* {@inheritdoc}
*/
@@ -104,7 +105,6 @@ class SharethisManager implements SharethisManagerInterface {
}
}
-
/**
* {@inheritdoc}
*/
@@ -191,18 +191,17 @@ class SharethisManager implements SharethisManagerInterface {
$data_options['services'] .= ',"' . $service . '"';
}
- // Share buttons are simply spans of the form class='st_SERVICE_BUTTONTYPE'
- // where -- "st" stands for ShareThis.
+ // The share buttons are simply spans of the form class='st_SERVICE_BUTTONTYPE' -- "st" stands for ShareThis.
$type = Unicode::substr($data_options['buttons'], 4);
$type = $type == "_" ? "" : Html::escape($type);
$service_array = explode(",", $data_options['services']);
$st_spans = "";
foreach ($service_array as $service_full) {
- // Strip the quotes from element in array (They are there for javascript).
+ // Strip the quotes from the element in the array (They are there for javascript).
$service = explode(":", $service_full);
- // Service names are expected to be parsed by Name:machine_name. If only
- // one element in the array is given, it's an invalid service.
+ // Service names are expected to be parsed by Name:machine_name. If only one
+ // element in the array is given, it's an invalid service.
if (count($service) < 2) {
continue;
}
diff --git a/src/SharethisManagerInterface.php b/src/SharethisManagerInterface.php
index c1cdf7f..ac1046c 100644
--- a/src/SharethisManagerInterface.php
+++ b/src/SharethisManagerInterface.php
@@ -15,7 +15,7 @@ interface SharethisManagerInterface {
/**
* Determine if connection should be refreshed.
*
- * @return array
+ * @return []
* Returns the list of options that sharethis provides.
*/
public function getOptions();
@@ -24,20 +24,17 @@ interface SharethisManagerInterface {
* Custom html block.
*
* @return array
- * Return array renderable by renderSpans().
*/
public function blockContents();
/**
* Custom html markup for widget.
*
- * @param array $array
- * Settings array.
+ * @param $array
*
* @return array
- * Return array renderable by renderSpans().
*/
- public function widgetContents(array $array);
+ public function widgetContents($array);
/**
* Include st js scripts.
@@ -46,25 +43,22 @@ interface SharethisManagerInterface {
/**
- * Function is creating options to be passed to stLight.
+ * function is creating options to be passed to stLight.
*
* @param array $data_options
* The settings selected by publisher in admin panel.
*
- * @return array
- * An array of options.
*/
- public function getShareThisLightOptions(array $data_options);
+ public function getShareThisLightOptions($data_options);
/**
* Converts given value to boolean.
*
- * @param string $val
- * Which value to convert to boolean.
+ * @param $val
+ * Which value to convert to boolean
*
* @return bool
- * Return TRUE or FALSE.
*
* @todo To be replaced with bool
*/
@@ -74,15 +68,11 @@ interface SharethisManagerInterface {
* Custom html block.
*
* @param array $array
- * Settings array.
* @param string $title
- * Title string.
* @param string $string
- * Sharethis path.
*
* @return array
- * Array with options, title and path.
*/
- public function renderSpans(array $array, $title, $string);
+ public function renderSpans($array, $title, $string);
}
diff --git a/src/Tests/SharethisBlockTest.php b/src/Tests/SharethisBlockTest.php
index acf5089..f463d91 100644
--- a/src/Tests/SharethisBlockTest.php
+++ b/src/Tests/SharethisBlockTest.php
@@ -45,12 +45,12 @@ class SharethisBlockTest extends NodeTestBase {
$edit['location'] = 'block';
$this->drupalPostForm('admin/config/services/sharethis', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Saved configuration'));
- // Test availability of sharethis block in the admin "Place blocks" list.
+ // Test availability of the sharethis block in the admin "Place blocks" list.
\Drupal::service('theme_handler')->install(['bartik', 'seven', 'stark']);
$theme_settings = $this->config('system.theme');
foreach (['bartik', 'seven', 'stark'] as $theme) {
$this->drupalGet('admin/structure/block/list/' . $theme);
- $this->assertTitle(t('Block layout') . ' | Drupal');
+ $this->assertTitle(t('Block layout | Drupal'));
// Select the 'Sharethis' block to be placed.
$block = array();
$block['id'] = strtolower($this->randomMachineName());
diff --git a/src/Tests/Views/SharethisViewsPluginTest.php b/src/Tests/Views/SharethisViewsPluginTest.php
index 8024bd2..f92958e 100644
--- a/src/Tests/Views/SharethisViewsPluginTest.php
+++ b/src/Tests/Views/SharethisViewsPluginTest.php
@@ -51,8 +51,9 @@ class SharethisViewsPluginTest extends ViewTestBase {
* Tests the handlers.
*/
public function testHandlers() {
- $this->drupalCreateNode();
- $this->drupalCreateNode();
+ $nodes = array();
+ $nodes[] = $this->drupalCreateNode();
+ $nodes[] = $this->drupalCreateNode();
// Test the sharethis field.
$view = Views::getView('test_sharethis');
$view->setDisplay('page_1');