You are here

function ds_edit_block_field_form in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_ui/includes/ds.fields.inc \ds_edit_block_field_form()

Manage a custom block.

2 string references to 'ds_edit_block_field_form'
ds_ajax_add_field in ./ds.field_ui.inc
Handles ctools modal Add field
ds_menu in ./ds.module
Implements hook_menu().

File

./ds.fields.inc, line 338
Administrative functions for managing custom fields for every entity.

Code

function ds_edit_block_field_form($form, &$form_state, $custom_block = '') {
  $custom_block = ds_shared_form($form, $custom_block);
  $blocks = array();
  foreach (module_implements('block_info') as $module) {
    $module_blocks = module_invoke($module, 'block_info');
    if ($module_blocks) {
      foreach ($module_blocks as $module_key => $info) {
        $blocks[drupal_ucfirst($module)][$module . '|' . $module_key] = $info['info'];
      }
    }
  }
  ksort($blocks);
  $form['block_identity']['block'] = array(
    '#type' => 'select',
    '#options' => $blocks,
    '#title' => t('Block'),
    '#required' => TRUE,
    '#default_value' => isset($custom_block->properties['block']) ? $custom_block->properties['block'] : '',
  );
  $form['block_identity']['block_render'] = array(
    '#type' => 'select',
    '#options' => array(
      DS_BLOCK_TEMPLATE => t('Default'),
      DS_BLOCK_TITLE_CONTENT => t('Show block title + content'),
      DS_BLOCK_CONTENT => t('Show only block content'),
    ),
    '#title' => t('Layout'),
    '#required' => TRUE,
    '#default_value' => isset($custom_block->properties['block_render']) ? $custom_block->properties['block_render'] : '',
  );
  $form['#validate'][] = 'ds_block_field_form_validate';
  return $form;
}