1.20.x block.class.inc Block::getAdminConditionsPreview()

Return a fieldset listing any visibility conditions set for this block.

File

modules/layout/includes/block.class.inc, line 195
A class that wraps around a block to store settings information.

Class

Block
@file A class that wraps around a block to store settings information.

Code

function getAdminConditionsPreview() {
  $preview = '';

  if (!empty($this->conditions)) {
    $condition_list = array();
    foreach ($this->conditions as $condition) {
      $condition_list[] = $condition->summary();
    }
    $conditions = theme('item_list', array('items' => $condition_list, 'attributes' => array('class' => array('block-conditions'))));
    $fieldset = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#title' => t('Conditions'),
      '#children' => $conditions,
      '#parents' => array(),
    );
    $form_state = array();
    form_process_fieldset($fieldset, $form_state);

    $preview = backdrop_render($fieldset);
  }
  return $preview;
}