Merge branch 'dev' of ssh://git.autonomic.zone:2222/autonomic-cooperative/opencase into dev
This commit is contained in:
commit
8d345ce1f3
@ -20,7 +20,7 @@ div[data-drupal-selector=edit-user-bulk-form] {
|
||||
}
|
||||
|
||||
/* Free the people from the tyranny of the useless search button */
|
||||
#edit-submit-actor-search, #edit-submit-actor-search-2{
|
||||
#edit-submit-actor-search, #edit-submit-actor-search--2{
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
opencase_entities.oc_case_type.*:
|
||||
opencase_cases.oc_case_type.*:
|
||||
type: config_entity
|
||||
label: 'Case type config'
|
||||
mapping:
|
||||
|
@ -49,7 +49,7 @@ function opencase_cases_entity_base_field_info($entity_type) {
|
||||
|
||||
// Add Case field to Activity
|
||||
if ($entity_type->id() === 'oc_activity') {
|
||||
$fields['oc_case'] = BaseFieldDefinition::create('entity_reference')
|
||||
$fields['oc_case'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Case'))
|
||||
->setDescription(t('The case this activity belongs to.'))
|
||||
->setSetting('target_type', 'oc_case')
|
||||
@ -66,12 +66,11 @@ function opencase_cases_entity_base_field_info($entity_type) {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
/* When creating an activity, it sets the case id from the URL.
|
||||
/*/
|
||||
public static function opencase_cases_default_activity_case_value() {
|
||||
return array(\Drupal::request()->query->get('case_id'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_form_alter()
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
class CaseInvolvement {
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Controller;
|
||||
namespace Drupal\opencase_cases\Controller;
|
||||
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
|
||||
/**
|
||||
* Class OCCaseController.
|
||||
@ -48,7 +48,7 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
||||
/**
|
||||
* Generates an overview table of older revisions of a Case .
|
||||
*
|
||||
* @param \Drupal\opencase_entities\Entity\OCCaseInterface $oc_case
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $oc_case
|
||||
* A Case object.
|
||||
*
|
||||
* @return array
|
||||
@ -75,7 +75,7 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
||||
$latest_revision = TRUE;
|
||||
|
||||
foreach (array_reverse($vids) as $vid) {
|
||||
/** @var \Drupal\opencase_entities\OCCaseInterface $revision */
|
||||
/** @var \Drupal\opencase_cases\OCCaseInterface $revision */
|
||||
$revision = $oc_case_storage->loadRevision($vid);
|
||||
// Only show revisions that are affected by the language that is being
|
||||
// displayed.
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
@ -13,28 +13,28 @@ use Drupal\user\UserInterface;
|
||||
/**
|
||||
* Defines the Case entity.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "oc_case",
|
||||
* label = @Translation("Case"),
|
||||
* bundle_label = @Translation("Case type"),
|
||||
* handlers = {
|
||||
* "storage" = "Drupal\opencase_entities\OCCaseStorage",
|
||||
* "storage" = "Drupal\opencase_cases\OCCaseStorage",
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_entities\OCCaseListBuilder",
|
||||
* "views_data" = "Drupal\opencase_entities\Entity\OCCaseViewsData",
|
||||
* "translation" = "Drupal\opencase_entities\OCCaseTranslationHandler",
|
||||
* "list_builder" = "Drupal\opencase_cases\OCCaseListBuilder",
|
||||
* "views_data" = "Drupal\opencase_cases\Entity\OCCaseViewsData",
|
||||
* "translation" = "Drupal\opencase_cases\OCCaseTranslationHandler",
|
||||
*
|
||||
* "form" = {
|
||||
* "default" = "Drupal\opencase_entities\Form\OCCaseForm",
|
||||
* "add" = "Drupal\opencase_entities\Form\OCCaseForm",
|
||||
* "edit" = "Drupal\opencase_entities\Form\OCCaseForm",
|
||||
* "delete" = "Drupal\opencase_entities\Form\OCCaseDeleteForm",
|
||||
* "default" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||
* "add" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||
* "edit" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||
* "delete" = "Drupal\opencase_cases\Form\OCCaseDeleteForm",
|
||||
* },
|
||||
* "access" = "Drupal\opencase_entities\OCCaseAccessControlHandler",
|
||||
* "access" = "Drupal\opencase_cases\OCCaseAccessControlHandler",
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\opencase_entities\OCCaseHtmlRouteProvider",
|
||||
* "html" = "Drupal\opencase_cases\OCCaseHtmlRouteProvider",
|
||||
* },
|
||||
* },
|
||||
* base_table = "oc_case",
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityInterface;
|
||||
use Drupal\Core\Entity\RevisionLogInterface;
|
||||
@ -10,7 +10,7 @@ use Drupal\user\EntityOwnerInterface;
|
||||
/**
|
||||
* Provides an interface for defining Case entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface {
|
||||
|
||||
@ -30,7 +30,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
||||
* @param string $name
|
||||
* The Case name.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setName($name);
|
||||
@ -49,7 +49,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
||||
* @param int $timestamp
|
||||
* The Case creation timestamp.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setCreatedTime($timestamp);
|
||||
@ -70,7 +70,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
||||
* @param bool $published
|
||||
* TRUE to set this Case to published, FALSE to set it to unpublished.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setPublished($published);
|
||||
@ -89,7 +89,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
||||
* @param int $timestamp
|
||||
* The UNIX timestamp of when this revision was created.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setRevisionCreationTime($timestamp);
|
||||
@ -108,7 +108,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
||||
* @param int $uid
|
||||
* The user ID of the revision author.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setRevisionUserId($uid);
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
|
||||
@ -11,16 +11,16 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* id = "oc_case_type",
|
||||
* label = @Translation("Case type"),
|
||||
* handlers = {
|
||||
* "access" = "Drupal\opencase_entities\OCCaseTypeAccessControlHandler",
|
||||
* "access" = "Drupal\opencase_cases\OCCaseTypeAccessControlHandler",
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_entities\OCCaseTypeListBuilder",
|
||||
* "list_builder" = "Drupal\opencase_cases\OCCaseTypeListBuilder",
|
||||
* "form" = {
|
||||
* "add" = "Drupal\opencase_entities\Form\OCCaseTypeForm",
|
||||
* "edit" = "Drupal\opencase_entities\Form\OCCaseTypeForm",
|
||||
* "delete" = "Drupal\opencase_entities\Form\OCCaseTypeDeleteForm"
|
||||
* "add" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
|
||||
* "edit" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
|
||||
* "delete" = "Drupal\opencase_cases\Form\OCCaseTypeDeleteForm"
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\opencase_entities\OCCaseTypeHtmlRouteProvider",
|
||||
* "html" = "Drupal\opencase_cases\OCCaseTypeHtmlRouteProvider",
|
||||
* },
|
||||
* },
|
||||
* config_prefix = "oc_case_type",
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Entity;
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\views\EntityViewsData;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
||||
/**
|
||||
* Provides a form for deleting Case entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseDeleteForm extends ContentEntityDeleteForm {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
@ -8,7 +8,7 @@ use Drupal\Core\Form\FormStateInterface;
|
||||
/**
|
||||
* Form controller for Case edit forms.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseForm extends ContentEntityForm {
|
||||
|
||||
@ -16,7 +16,7 @@ class OCCaseForm extends ContentEntityForm {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
/* @var $entity \Drupal\opencase_entities\Entity\OCCase */
|
||||
/* @var $entity \Drupal\opencase_cases\Entity\OCCase */
|
||||
$form = parent::buildForm($form, $form_state);
|
||||
|
||||
if (!$this->entity->isNew()) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
/**
|
||||
* Provides a form for deleting a Case revision.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseRevisionDeleteForm extends ConfirmFormBase {
|
||||
|
||||
@ -20,7 +20,7 @@ class OCCaseRevisionDeleteForm extends ConfirmFormBase {
|
||||
/**
|
||||
* The Case revision.
|
||||
*
|
||||
* @var \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @var \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
*/
|
||||
protected $revision;
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a form for reverting a Case revision.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
||||
|
||||
@ -21,7 +21,7 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
||||
/**
|
||||
* The Case revision.
|
||||
*
|
||||
* @var \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @var \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
*/
|
||||
protected $revision;
|
||||
|
||||
@ -130,12 +130,12 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
||||
/**
|
||||
* Prepares a revision to be reverted.
|
||||
*
|
||||
* @param \Drupal\opencase_entities\Entity\OCCaseInterface $revision
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $revision
|
||||
* The revision to be reverted.
|
||||
* @param \Drupal\Core\Form\FormStateInterface $form_state
|
||||
* The current state of the form.
|
||||
*
|
||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The prepared revision ready to be stored.
|
||||
*/
|
||||
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
||||
|
@ -1,18 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a form for reverting a Case revision for a single translation.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
|
||||
|
||||
@ -93,7 +93,7 @@ class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
|
||||
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
||||
$revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields');
|
||||
|
||||
/** @var \Drupal\opencase_entities\Entity\OCCaseInterface $default_revision */
|
||||
/** @var \Drupal\opencase_cases\Entity\OCCaseInterface $default_revision */
|
||||
$latest_revision = $this->OCCaseStorage->load($revision->id());
|
||||
$latest_revision_translation = $latest_revision->getTranslation($this->langcode);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
@ -8,7 +8,7 @@ use Drupal\Core\Form\FormStateInterface;
|
||||
/**
|
||||
* Class OCCaseSettingsForm.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseSettingsForm extends FormBase {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
@ -30,7 +30,7 @@ class OCCaseTypeForm extends EntityForm {
|
||||
'#type' => 'machine_name',
|
||||
'#default_value' => $oc_case_type->id(),
|
||||
'#machine_name' => [
|
||||
'exists' => '\Drupal\opencase_entities\Entity\OCCaseType::load',
|
||||
'exists' => '\Drupal\opencase_cases\Entity\OCCaseType::load',
|
||||
],
|
||||
'#disabled' => !$oc_case_type->isNew(),
|
||||
];
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\opencase_entities\CaseInvolvement;
|
||||
use Drupal\opencase_cases\CaseInvolvement;
|
||||
|
||||
/**
|
||||
* Access controller for the Case entity.
|
||||
*
|
||||
* @see \Drupal\opencase_entities\Entity\OCCase.
|
||||
* @see \Drupal\opencase_cases\Entity\OCCase.
|
||||
*/
|
||||
class OCCaseAccessControlHandler extends EntityAccessControlHandler {
|
||||
|
||||
@ -19,7 +19,7 @@ class OCCaseAccessControlHandler extends EntityAccessControlHandler {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||
/** @var \Drupal\opencase_entities\Entity\OCCaseInterface $entity */
|
||||
/** @var \Drupal\opencase_cases\Entity\OCCaseInterface $entity */
|
||||
switch ($operation) {
|
||||
case 'view':
|
||||
if (!$entity->isPublished()) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||
@ -64,7 +64,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
$route
|
||||
->setDefaults([
|
||||
'_title' => "{$entity_type->getLabel()} revisions",
|
||||
'_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionOverview',
|
||||
'_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionOverview',
|
||||
])
|
||||
->setRequirement('_permission', 'access case revisions')
|
||||
->setOption('_admin_route', TRUE);
|
||||
@ -87,8 +87,8 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
$route = new Route($entity_type->getLinkTemplate('revision'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionShow',
|
||||
'_title_callback' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionPageTitle',
|
||||
'_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionShow',
|
||||
'_title_callback' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionPageTitle',
|
||||
])
|
||||
->setRequirement('_permission', 'access case revisions')
|
||||
->setOption('_admin_route', TRUE);
|
||||
@ -111,7 +111,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
$route = new Route($entity_type->getLinkTemplate('revision_revert'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertForm',
|
||||
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertForm',
|
||||
'_title' => 'Revert to earlier revision',
|
||||
])
|
||||
->setRequirement('_permission', 'revert all case revisions')
|
||||
@ -135,7 +135,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
$route = new Route($entity_type->getLinkTemplate('revision_delete'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionDeleteForm',
|
||||
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionDeleteForm',
|
||||
'_title' => 'Delete earlier revision',
|
||||
])
|
||||
->setRequirement('_permission', 'delete all case revisions')
|
||||
@ -159,7 +159,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
$route = new Route($entity_type->getLinkTemplate('translation_revert'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertTranslationForm',
|
||||
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertTranslationForm',
|
||||
'_title' => 'Revert to earlier revision of a translation',
|
||||
])
|
||||
->setRequirement('_permission', 'revert all case revisions')
|
||||
@ -183,7 +183,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => 'Drupal\opencase_entities\Form\OCCaseSettingsForm',
|
||||
'_form' => 'Drupal\opencase_cases\Form\OCCaseSettingsForm',
|
||||
'_title' => "{$entity_type->getLabel()} settings",
|
||||
])
|
||||
->setRequirement('_permission', $entity_type->getAdminPermission())
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityListBuilder;
|
||||
@ -9,7 +9,7 @@ use Drupal\Core\Link;
|
||||
/**
|
||||
* Defines a class to build a listing of Case entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseListBuilder extends EntityListBuilder {
|
||||
|
||||
@ -27,7 +27,7 @@ class OCCaseListBuilder extends EntityListBuilder {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildRow(EntityInterface $entity) {
|
||||
/* @var $entity \Drupal\opencase_entities\Entity\OCCase */
|
||||
/* @var $entity \Drupal\opencase_cases\Entity\OCCase */
|
||||
$row['id'] = $entity->id();
|
||||
$row['name'] = Link::createFromRoute(
|
||||
$entity->label(),
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
|
||||
/**
|
||||
* Defines the storage handler class for Case entities.
|
||||
@ -13,7 +13,7 @@ use Drupal\opencase_entities\Entity\OCCaseInterface;
|
||||
* This extends the base storage class, adding required special handling for
|
||||
* Case entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseStorage extends SqlContentEntityStorage implements OCCaseStorageInterface {
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityStorageInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
|
||||
/**
|
||||
* Defines the storage handler class for Case entities.
|
||||
@ -13,14 +13,14 @@ use Drupal\opencase_entities\Entity\OCCaseInterface;
|
||||
* This extends the base storage class, adding required special handling for
|
||||
* Case entities.
|
||||
*
|
||||
* @ingroup opencase_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
interface OCCaseStorageInterface extends ContentEntityStorageInterface {
|
||||
|
||||
/**
|
||||
* Gets a list of Case revision IDs for a specific Case.
|
||||
*
|
||||
* @param \Drupal\opencase_entities\Entity\OCCaseInterface $entity
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $entity
|
||||
* The Case entity.
|
||||
*
|
||||
* @return int[]
|
||||
@ -42,7 +42,7 @@ interface OCCaseStorageInterface extends ContentEntityStorageInterface {
|
||||
/**
|
||||
* Counts the number of revisions in the default language.
|
||||
*
|
||||
* @param \Drupal\opencase_entities\Entity\OCCaseInterface $entity
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $entity
|
||||
* The Case entity.
|
||||
*
|
||||
* @return int
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\content_translation\ContentTranslationHandler;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
@ -11,7 +11,7 @@ use Drupal\Core\Access\AccessResult;
|
||||
* Defines the access control handler for the OCCaseType Config Entity.
|
||||
* Always allows viewing the label of the bundle.
|
||||
*
|
||||
* @see Drupal\opencase_entities\Entity\OCCaseType
|
||||
* @see Drupal\opencase_cases\Entity\OCCaseType
|
||||
*/
|
||||
class OCCaseTypeAccessControlHandler extends EntityAccessControlHandler {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
@ -23,8 +23,8 @@ class ContextualMenu extends BlockBase {
|
||||
*/
|
||||
public function build() {
|
||||
$route_name = \Drupal::routeMatch()->getRouteName();
|
||||
\Drupal::logger('my_module')->error(\Drupal::routeMatch()->getParameter('oc_actor')->bundle());
|
||||
if ($route_name == 'entity.oc_actor.canonical' && \Drupal::routeMatch()->getParameter('oc_actor')->bundle() == 'client' ) {
|
||||
;
|
||||
$markup = $this->actorPage();
|
||||
$build = [];
|
||||
$build['contextual_menu'] = [
|
||||
@ -42,20 +42,20 @@ class ContextualMenu extends BlockBase {
|
||||
*/
|
||||
private function actorPage() {
|
||||
$actor_id = \Drupal::routeMatch()->getParameter('oc_actor')->id();
|
||||
$current_path = \Drupal::service('path.current')->getPath();
|
||||
return $this->generateLinksForAddingNewActivities("Add activity", ['actor_id' => $actor_id, 'destination' => $current_path]);
|
||||
return $this->generateLinksForAddingNewActivities("Add activity", $actor_id);
|
||||
}
|
||||
/**
|
||||
* returns html markup.
|
||||
*/
|
||||
private function generateLinksForAddingNewActivities($title, $query = []) {
|
||||
private function generateLinksForAddingNewActivities($title, $actor_id) {
|
||||
$title = t($title);
|
||||
$markup = "<br /><p><strong>$title: </strong>";
|
||||
$allActivityTypes = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_activity');
|
||||
$redirect_destination = \Drupal\Core\Url::fromRoute("entity.oc_actor.canonical", ['oc_actor' => $actor_id])->toString();
|
||||
foreach($allActivityTypes as $machine_name => $activityType) {
|
||||
$label = $activityType['label'];
|
||||
$url = \Drupal\Core\Url::fromRoute("entity.oc_activity.add_form", ['oc_activity_type' => $machine_name]);
|
||||
$url->setOption('query', $query);
|
||||
$url->setOption('query', ['actor_id' => $actor_id, 'destination' => $redirect_destination]);
|
||||
$link = \Drupal\Core\Link::fromTextAndUrl($label, $url)->toString();
|
||||
$markup .= " $link";
|
||||
}
|
||||
|
Reference in New Issue
Block a user