Add case block is working
This commit is contained in:
parent
2b4b9696db
commit
07683cd1b8
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
|
||||
/**
|
||||
* Provides a Block for adding a case for the current client
|
||||
*
|
||||
* @Block(
|
||||
* id = "add_case",
|
||||
* admin_label = @Translation("Add Case"),
|
||||
* category = @Translation("Opencase"),
|
||||
* )
|
||||
*/
|
||||
class AddCase extends BlockBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build():array {
|
||||
$target_id = \Drupal::routeMatch()->getParameter('oc_actor')->id();
|
||||
$case_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_case');
|
||||
$markup = "<ul>";
|
||||
foreach($case_types as $id => $info) {
|
||||
$label = $info['label'];
|
||||
$markup .= "<li><a href='/opencase/oc_case/add/$id?target_id=$target_id'>$label</a></li>";
|
||||
}
|
||||
$markup .= "</ul>";
|
||||
return array(
|
||||
'#markup' => $markup
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function getCacheMaxAge():int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -26,8 +26,7 @@ class AddCase extends BlockBase {
|
||||
$case_types = $this->getCaseTypesToDisplay($actorType);
|
||||
foreach($case_types as $id => $info) {
|
||||
$label = $info['label'];
|
||||
$markup .= "foo";
|
||||
#$markup .= "<li><a href='/opencase/oc_case/add/$id?target_id=$target_id&destination=/opencase/oc_actor/$target_id'>$label</a></li>";
|
||||
$markup .= "<li><a href='/opencase/oc_case/add/$id?target_id=$target_id&destination=/opencase/oc_actor/$target_id'>$label</a></li>";
|
||||
}
|
||||
$markup .= "</ul>";
|
||||
return array('#markup' => $markup);
|
||||
|
Reference in New Issue
Block a user