public function get_configure_block()
{
Utils::check_request_method(array('GET', 'POST'));
$block = DB::get_row('SELECT b.* FROM {blocks} b WHERE id = :id ORDER BY b.title ASC', array('id' => $_GET['blockid']), 'Block');
/** @var FormUI $block_form */
$block_form = $block->get_form();
// @todo This. Is dumb. Fix it.
$block_form->set_properties(array('success_message' => '</div><div class="humanMsg" id="humanMsg" style="display: block;top: auto;bottom:-50px;"><div class="imsgs"><div id="msgid_2" class="msg" style="display: block; opacity: 0.8;"><p>' . _t('Saved block configuration.') . '</p></div></div></div>
<script type="text/javascript">
$("#humanMsg").animate({bottom: "5px"}, 500, function(){ window.setTimeout(function(){$("#humanMsg").animate({bottom: "-50px"}, 500)},3000) })
parent.refresh_block_forms();
</script>
<div style="display:none;">
'));
$first_control = reset($block_form->controls);
$block_admin = FormControlFieldset::create('block_admin')->set_caption(_t('Block Display Settings'));
if ($first_control) {
$block_form->insert($first_control, $block_admin);
} else {
$block_form->append($block_admin);
}
$block_title_storage = new ControlStorage(function () use($block) {
return $block->title;
}, function ($name, $value) use($block) {
$block->title = $value;
});
$block_admin->append(FormControlLabel::wrap(_t('Block Title:'), FormControlText::create('_title', $block_title_storage)->add_validator('validate_required')));
$block_admin->append(FormControlLabel::wrap(_t('Display Block Title:'), FormControlCheckbox::create('_show_title', $block)));
$block_form->append(FormControlSubmit::create('save')->set_caption(_t('Save')));
$this->theme->content = $block_form->get();
$this->display('block_configure');
}