Project

General

Profile

Revision 2c8c2b87

Added by Assos Assos about 9 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/addthis/addthis.module
80 80
    'file' => AddThis::ADMIN_INCLUDE_FILE,
81 81
    'weight' => 10
82 82
  );
83

  
83 84
  return $menu_items;
84 85
}
85 86

  
......
142 143
  );
143 144
}
144 145

  
146
/**
147
 * Implements hook_page_build().
148
 */
149
function addthis_page_build(&$page) {
150
  // Include the addthis.js as a library on every page. Widget js will be loaded
151
  // according to the settings.
152
  $addthis_js_path = drupal_get_path('module', 'addthis') . '/addthis.js';
153
  $page['content']['#attached']['js'][$addthis_js_path] = array(
154
    'type' => 'file',
155
    'scope' => 'footer',
156
  );
157

  
158
  // Include the widget js when we include on all but admin pages.
159
  if (!path_is_admin(current_path()) && AddThis::getInstance()->getWidgetJsInclude() == AddThis::WIDGET_JS_INCLUDE_PAGE) {
160
    $manager = AddThisScriptManager::getInstance();
161
    $manager->attachJsToElement($page['content']);
162
  }
163
}
164

  
145 165
/**
146 166
 * Implements hook_preprocess() for theme_addthis.
147 167
 */
......
199 219
/**
200 220
 * Create a addthis settings form.
201 221
 */
202
function _addthis_settings_form($form = array(), &$form_state, $display_type = NULL, $display_settings = NULL) {
203
  // Toggle variables
204
  $no_js = FALSE;
222
function _addthis_settings_form($form = array(), &$form_state = array(), $display_type = NULL, $display_settings = array()) {
205 223

  
224
  // Check display setting to be not null.
225
  if (!isset($display_settings) || (isset($display_settings) && !is_array($display_settings))) {
226
    $display_settings = array();
227
  }
228

  
229
  // Toggle variables.
230
  $no_js = FALSE;
206 231

  
207 232
  // Default display type if not set in the parameters.
208 233
  $display_type = (isset($display_type)) ? $display_type : 'addthis_disabled';

Also available in: Unified diff