Projet

Général

Profil

Révision 08475715

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/panels/includes/common.inc
196 196
   */
197 197
  function save() {
198 198
    if (!is_null($this->module_name)) {
199
      variable_set($this->module_name . "_allowed_layouts", serialize($this));
199
      variable_set($this->module_name . '_allowed_layouts', serialize($this));
200 200
    }
201 201
  }
202 202

  
......
272 272
    // each type its own checkboxes set unless it's 'single' in which
273 273
    // case it can go into our fake other set.
274 274
    $available_content_types = ctools_content_get_all_types();
275
    $allowed_content_types = variable_get($module_name . '_allowed_types', array());
275
    $allowed_content_types = db_select('panels_allowed_types', 'pat')
276
      ->fields('pat', array('type', 'allowed'))
277
      ->condition('module', $module_name)
278
      ->execute()
279
      ->fetchAllKeyed();
276 280

  
277 281
    foreach ($available_content_types as $id => $types) {
278 282
      foreach ($types as $type => $info) {
......
354 358
  if (!$form_state['skip']) {
355 359
    // Merge the broken apart array neatly back together.
356 360
    $allowed_content_types = array();
357
    foreach ($form_state['values']['allowed'] as $allowed) {
358
      $values = $form_state['values']['content_types'][$allowed]['options'];
359
      // If new content of the type is not added, storing a lisy of disabled
360
      // content is not needed.
361
      if (!$form_state['values']['panels_common_default'][$allowed]) {
362
        $values = array_filter($values);
361
    $content_types = $form_state['values']['allowed'];
362
    foreach ($content_types as $content_type) {
363
      $allowed_content_types = array_merge($allowed_content_types, $form_state['values']['content_types'][$content_type]['options']);
364
      foreach ($allowed_content_types as $type => $allowed) {
365
        $allowed = empty($allowed) ? 0 : 1;
366
        db_merge('panels_allowed_types')
367
          ->key(array('module' => $module_name, 'type' => $type))
368
          ->fields(array(
369
            'module' => $module_name,
370
            'type' => $type,
371
            'allowed' => $allowed,
372
          ))
373
          ->execute();
363 374
      }
364
      $allowed_content_types = array_merge($allowed_content_types, $values);
365 375
    }
366
    // Values from checkboxes are the same string as they key, but we only need
367
    // to store the boolean value.
368
    foreach ($allowed_content_types as &$value) {
369
      $value = (bool) $value;
370
    }
371
    variable_set($module_name . '_allowed_types', $allowed_content_types);
372 376
  }
373 377
  drupal_set_message(t('Your changes have been saved.'));
374 378
}
......
378 382
 */
379 383
function panels_common_get_allowed_types($module, $contexts = array(), $has_content = FALSE, $default_defaults = array(), $default_allowed_types = array()) {
380 384
  // Get a list of all types that are available
381

  
382 385
  $default_types = variable_get($module . '_default', $default_defaults);
383
  $allowed_types = variable_get($module . '_allowed_types', $default_allowed_types);
386
  $allowed_types = db_select('panels_allowed_types', 'pat')
387
    ->fields('pat', array('type', 'allowed'))
388
    ->condition('module', $module)
389
    ->execute()
390
    ->fetchAllKeyed();
391
  $allowed_types = !empty($allowed_types) ? $allowed_types : $default_allowed_types;
384 392

  
385 393
  // By default, if they haven't gone and done the initial setup here,
386 394
  // let all 'other' types (which will be all types) be available.
......
465 473
 * Get the allowed layout object for the given module.
466 474
 */
467 475
function panels_common_get_allowed_layout_object($module_name) {
468
  $allowed_layouts = unserialize(variable_get($module_name . "_allowed_layouts", serialize('')));
476
  $allowed_layouts = unserialize(variable_get($module_name . '_allowed_layouts', serialize('')));
469 477

  
470 478
  // if no parameter was provided, or the variable_get failed
471 479
  if (!$allowed_layouts) {

Formats disponibles : Unified diff