You are here

public function BlockEditor::load in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 src/Editor/BlockEditor.php \Drupal\forena\Editor\BlockEditor::load()

Block loader method.

Parameters

$block_name:

1 call to BlockEditor::load()
BlockEditor::__construct in src/Editor/BlockEditor.php

File

src/Editor/BlockEditor.php, line 35

Class

BlockEditor

Namespace

Drupal\forena\Editor

Code

public function load($block_name, $edit = TRUE) {
  $block_name = str_replace('.', '/', $block_name);
  @(list($provider, $path) = explode('/', $block_name, 2));
  $this->provider = $provider;
  $this->block_name = $block_name;
  if (isset($_SESSION['forena_query_editor'][$block_name]) && $edit) {
    $block = $_SESSION['forena_query_editor'][$block_name];
    drupal_set_message(t('All changes are stored temporarily.  Click Save to make your changes permanent.  Click Cancel to discard your changes.'), 'warning', FALSE);
    $this->modified = TRUE;
  }
  else {
    $block = Frx::DataManager()
      ->loadBlock($block_name);
    $this->modified = FALSE;
    if (!$block) {
      $block = $this->block = $this->new_block;
      $this
        ->update($this->block);
    }
  }
  $this->block = $block;
  return $block;
}