Started on Reporting Presets block.
This commit is contained in:
parent
cc108076bb
commit
e5db0007c9
@ -23,6 +23,18 @@ function opencase_reporting_help($route_name, RouteMatchInterface $route_match)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function opencase_reporting_theme() {
|
||||
return array(
|
||||
'opencase_reporting_presets' => array(
|
||||
'variables' => array('presets' => array()),
|
||||
'template' => 'block--opencase-reporting-presets',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_page_attachments
|
||||
*
|
||||
|
29
modules/opencase_reporting/src/Plugin/Block/Presets.php
Normal file
29
modules/opencase_reporting/src/Plugin/Block/Presets.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_reporting\Plugin\Block;
|
||||
|
||||
use Drupal\opencase\EntityTypeRelations;
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Link;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Provides a block for loading, saving and creating report presets.
|
||||
*
|
||||
* @Block(
|
||||
* id = "opencase_reporting_presets",
|
||||
* admin_label = @Translation("OpenCase Reporting Presets"),
|
||||
* )
|
||||
*/
|
||||
class Presets extends BlockBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build() {
|
||||
return array(
|
||||
'#presets' => array(array('title'=>'me', 'url'=>'you'), array('title'=>'them', 'url'=>'us')),
|
||||
'#theme' => 'opencase_reporting_presets'
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<select id="opencase_reporting_presets_load">
|
||||
<option disabled selected>Load preset</option>
|
||||
{% for preset in presets %}
|
||||
<option value={{ preset.url }}>{{ preset.title }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
Reference in New Issue
Block a user