Project

General

Profile

Revision ecb492a9

Added by Assos Assos over 5 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/block_class/block_class.module
67 67
 * Alter block edit form to add configuration field.
68 68
 */
69 69
function block_class_form_alter(&$form, &$form_state, $form_id) {
70
  if (user_access('administer block classes') && ($form_id == 'block_admin_configure' || $form_id == 'block_add_block_form')) {
70
  // Form ids of modules with block creation pages also need to be checked.
71
  if (user_access('administer block classes') && (in_array($form_id, array(
72
    'block_admin_configure',
73
    'block_add_block_form',
74
    'menu_block_add_block_form',
75
  )))) {
71 76
    // Load statically cached block object used to display the form.
72 77
    $block = block_load($form['module']['#value'], $form['delta']['#value']);
73 78

  
......
89 94
 * Save supplied CSS classes.
90 95
 */
91 96
function block_class_form_submit($form, &$form_state) {
92
  if ($form_state['values']['form_id'] == 'block_admin_configure' || $form_state['values']['form_id'] == 'block_add_block_form') {
97
  // Form ids of modules with block creation pages also need to be checked.
98
  if (in_array($form_state['values']['form_id'], array(
99
    'block_admin_configure',
100
    'block_add_block_form',
101
    'menu_block_add_block_form',
102
  ))) {
93 103
    // Only save if value has changed.
94 104
    if (isset($form_state['values']['css_class']) && $form['settings']['css_class']['#default_value'] != $form_state['values']['css_class'] && user_access('administer blocks')) {
95 105
      db_update('block')

Also available in: Unified diff