Projet

Général

Profil

Révision 3dfa8105

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ds/modules/ds_extras/includes/ds_extras.admin.inc
114 114
    '#default_value' => variable_get('ds_extras_field_permissions', FALSE),
115 115
  );
116 116

  
117
  if (module_exists('block')) {
118
    $form['additional_settings']['fs4']['ds_extras_region_to_block'] = array(
119
      '#type' => 'checkbox',
120
      '#title' => t('Region to block'),
121
      '#description' => t('Create additional regions exposed as block. Note: this will not work on the default view mode.'),
122
      '#default_value' => variable_get('ds_extras_region_to_block', FALSE),
123
    );
124
  }
117
  $form['additional_settings']['fs4']['ds_extras_region_to_block'] = array(
118
    '#type' => 'checkbox',
119
    '#title' => t('Region to block'),
120
    '#description' => t('Create additional regions exposed as block. Note: this will not work on the default view mode.'),
121
    '#default_value' => variable_get('ds_extras_region_to_block', FALSE),
122
  );
125 123

  
126 124
  if (module_exists('views')) {
127 125
    $form['additional_settings']['fs4']['ds_extras_vd'] = array(
......
327 325
    );
328 326
  }
329 327

  
328
  // Add prefix
329
  $form['ft']['prefix'] = array(
330
    '#type' => 'textfield',
331
    '#title' => t('Prefix'),
332
    '#size' => '100',
333
    '#description' => t('You can enter any html in here.'),
334
    '#default_value' => isset($field_settings['prefix']) ? $field_settings['prefix'] : '',
335
    '#prefix' => '<div class="field-prefix">',
336
    '#suffix' => '</div>',
337
  );
338

  
330 339
  // Wrappers and label.
331 340
  $wrappers = array(
332 341
    'lb' => array('title' => t('Label')),
342
    'lbw' => array('title' => t('Label wrapper')),
333 343
    'ow' => array('title' => t('Outer wrapper')),
334 344
    'fis' => array('title' => t('Field items')),
335 345
    'fi' => array('title' => t('Field item')),
......
352 362
      '#size' => '10',
353 363
      '#description' => t('E.g. div, span, h2 etc.'),
354 364
      '#default_value' => isset($field_settings[$wrapper_key . '-el']) ? $field_settings[$wrapper_key . '-el'] : '',
365
      '#states' => array(
366
        'visible' => array(
367
          ':input[name$="[ft][' . $wrapper_key . ']"]' => array('checked' => TRUE),
368
        ),
369
      ),
355 370
    );
356 371
    $form['ft'][$wrapper_key . '-cl'] = array(
357 372
      '#type' => 'textfield',
......
359 374
      '#size' => '10',
360 375
      '#default_value' => isset($field_settings[$wrapper_key . '-cl']) ? $field_settings[$wrapper_key . '-cl'] : '',
361 376
      '#description' => t('E.g.') .' ' . implode(', ', $classes),
377
      '#states' => array(
378
        'visible' => array(
379
          ':input[name$="[ft][' . $wrapper_key . ']"]' => array('checked' => TRUE),
380
        ),
381
      ),
362 382
    );
363 383
    $form['ft'][$wrapper_key . '-at'] = array(
364 384
      '#type' => 'textfield',
......
366 386
      '#size' => '20',
367 387
      '#default_value' => isset($field_settings[$wrapper_key . '-at']) ? $field_settings[$wrapper_key . '-at'] : '',
368 388
      '#description' => t('E.g. name="anchor"'),
389
      '#states' => array(
390
        'visible' => array(
391
          ':input[name$="[ft][' . $wrapper_key . ']"]' => array('checked' => TRUE),
392
        ),
393
      ),
369 394
    );
370 395

  
371 396
    // Hide colon.
......
384 409
        '#type' => 'checkbox',
385 410
        '#title' => t('Add odd/even classes'),
386 411
        '#default_value' => isset($field_settings['fi-odd-even']) ? $field_settings['fi-odd-even'] : FALSE,
412
        '#states' => array(
413
          'visible' => array(
414
            ':input[name$="[ft][' . $wrapper_key . ']"]' => array('checked' => TRUE),
415
          ),
416
        ),
417
      );
418
    }
419
    if ($wrapper_key != 'lbw') {
420
      $form['ft'][$wrapper_key . '-def-at'] = array(
421
        '#type' => 'checkbox',
422
        '#title' => t('Add default attributes'),
423
        '#default_value' => isset($field_settings[$wrapper_key . '-def-at']) ? $field_settings[$wrapper_key . '-def-at'] : FALSE,
424
        '#suffix' => ($wrapper_key == 'ow') ? '' : '</div>',
425
        '#states' => array(
426
          'visible' => array(
427
            ':input[name$="[ft][' . $wrapper_key . ']"]' => array('checked' => TRUE),
428
          ),
429
        ),
430
      );
431
    }
432
    else {
433
      $form['ft'][$wrapper_key . '-def-at'] = array(
434
        '#markup' => '</div><div class="clearfix"></div>',
387 435
      );
388 436
    }
389
    $form['ft'][$wrapper_key . '-def-at'] = array(
390
      '#type' => 'checkbox',
391
      '#title' => t('Add default attributes'),
392
      '#default_value' => isset($field_settings[$wrapper_key . '-def-at']) ? $field_settings[$wrapper_key . '-def-at'] : FALSE,
393
      '#suffix' => ($wrapper_key == 'ow') ? '' : '</div><div class="clearfix"></div>',
394
    );
395 437

  
396 438
    // Default classes for outer wrapper.
397 439
    if ($wrapper_key == 'ow') {
......
399 441
        '#type' => 'checkbox',
400 442
        '#title' => t('Add default classes'),
401 443
        '#default_value' => isset($field_settings[$wrapper_key . '-def-cl']) ? $field_settings[$wrapper_key . '-def-cl'] : FALSE,
402
        '#suffix' => '</div><div class="clearfix"></div>',
444
        '#suffix' => '</div>',
445
        '#states' => array(
446
          'visible' => array(
447
            ':input[name$="[ft][' . $wrapper_key . ']"]' => array('checked' => TRUE),
448
          ),
449
        ),
403 450
      );
404 451
    }
405 452
  }
406 453

  
454
  // Add suffix
455
  $form['ft']['suffix'] = array(
456
    '#type' => 'textfield',
457
    '#title' => t('Suffix'),
458
    '#size' => '100',
459
    '#description' => t('You can enter any html in here.'),
460
    '#default_value' => isset($field_settings['suffix']) ? $field_settings['suffix'] : '',
461
    '#prefix' => '<div class="field-prefix">',
462
    '#suffix' => '</div>',
463
  );
464

  
407 465
  // Another label needs some other stuff.
408 466
  unset($form['ft']['lb']['#description']);
409 467
  $form['ft']['lb']['#type'] = 'textfield';
410 468
  $form['ft']['lb']['#size'] = '10';
411 469
  $form['ft']['lb']['#attributes'] = array('class' => array('label-change'));
412 470
  $form['ft']['lb']['#default_value'] = isset($field_settings['lb']) ? $field_settings['lb'] : '';
471

  
472
  // Let other modules make modifications to the settings form as needed.
473
  drupal_alter('ds_field_theme_functions_settings_form_alter', $form, $field_settings);
413 474
}
414 475

  
415 476
/**
......
504 565
    foreach ($remove as $key => $value) {
505 566
      if ($key === $value) {
506 567
        $variable_set = TRUE;
507
        db_delete('block')
508
          ->condition('delta', $key)
509
          ->condition('module', 'ds_extras')
510
          ->execute();
568
        if (module_exists('block')) {
569
          db_delete('block')
570
            ->condition('delta', $key)
571
            ->condition('module', 'ds_extras')
572
            ->execute();
573
        }
511 574
        unset($region_blocks[$key]);
512 575
      }
513 576
    }

Formats disponibles : Unified diff