fixed some issues caused by c&ping from opencase_entities
This commit is contained in:
parent
0f0281c58c
commit
bc98ecb541
@ -1,4 +1,4 @@
|
|||||||
opencase_entities.oc_case_type.*:
|
opencase_cases.oc_case_type.*:
|
||||||
type: config_entity
|
type: config_entity
|
||||||
label: 'Case type config'
|
label: 'Case type config'
|
||||||
mapping:
|
mapping:
|
||||||
|
@ -4,4 +4,4 @@ description: 'Provides case entities and a required field on activities linking
|
|||||||
core: 8.x
|
core: 8.x
|
||||||
package: 'OpenCase'
|
package: 'OpenCase'
|
||||||
dependencies:
|
dependencies:
|
||||||
- opencase_entities
|
- opencase_cases
|
||||||
|
@ -35,14 +35,13 @@ function opencase_cases_theme() {
|
|||||||
'render element' => 'elements',
|
'render element' => 'elements',
|
||||||
'file' => 'oc_case.page.inc',
|
'file' => 'oc_case.page.inc',
|
||||||
'template' => 'oc_case',
|
'template' => 'oc_case',
|
||||||
]
|
],
|
||||||
'oc_case_content_add_list' => [
|
'oc_case_content_add_list' => [
|
||||||
'render element' => 'content',
|
'render element' => 'content',
|
||||||
'variables' => ['content' => NULL],
|
'variables' => ['content' => NULL],
|
||||||
'file' => 'oc_case.page.inc',
|
'file' => 'oc_case.page.inc',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function opencase_cases_entity_base_field_info($entity_type) {
|
function opencase_cases_entity_base_field_info($entity_type) {
|
||||||
@ -50,7 +49,7 @@ function opencase_cases_entity_base_field_info($entity_type) {
|
|||||||
|
|
||||||
// Add Case field to Activity
|
// Add Case field to Activity
|
||||||
if ($entity_type->id() === 'oc_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'))
|
->setLabel(t('Case'))
|
||||||
->setDescription(t('The case this activity belongs to.'))
|
->setDescription(t('The case this activity belongs to.'))
|
||||||
->setSetting('target_type', 'oc_case')
|
->setSetting('target_type', 'oc_case')
|
||||||
@ -70,7 +69,7 @@ function opencase_cases_entity_base_field_info($entity_type) {
|
|||||||
/**
|
/**
|
||||||
* When creating an activity, it sets the case id from the URL.
|
* When creating an activity, it sets the case id from the URL.
|
||||||
*/
|
*/
|
||||||
public static function opencase_cases_default_activity_case_value() {
|
function opencase_cases_default_activity_case_value() {
|
||||||
return array(\Drupal::request()->query->get('case_id'));
|
return array(\Drupal::request()->query->get('case_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
class CaseInvolvement {
|
class CaseInvolvement {
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Controller;
|
namespace Drupal\opencase_cases\Controller;
|
||||||
|
|
||||||
use Drupal\Component\Utility\Xss;
|
use Drupal\Component\Utility\Xss;
|
||||||
use Drupal\Core\Controller\ControllerBase;
|
use Drupal\Core\Controller\ControllerBase;
|
||||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||||
use Drupal\Core\Url;
|
use Drupal\Core\Url;
|
||||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class OCCaseController.
|
* Class OCCaseController.
|
||||||
@ -48,7 +48,7 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
|||||||
/**
|
/**
|
||||||
* Generates an overview table of older revisions of a Case .
|
* 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.
|
* A Case object.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@ -75,7 +75,7 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
|||||||
$latest_revision = TRUE;
|
$latest_revision = TRUE;
|
||||||
|
|
||||||
foreach (array_reverse($vids) as $vid) {
|
foreach (array_reverse($vids) as $vid) {
|
||||||
/** @var \Drupal\opencase_entities\OCCaseInterface $revision */
|
/** @var \Drupal\opencase_cases\OCCaseInterface $revision */
|
||||||
$revision = $oc_case_storage->loadRevision($vid);
|
$revision = $oc_case_storage->loadRevision($vid);
|
||||||
// Only show revisions that are affected by the language that is being
|
// Only show revisions that are affected by the language that is being
|
||||||
// displayed.
|
// displayed.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Entity;
|
namespace Drupal\opencase_cases\Entity;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityStorageInterface;
|
use Drupal\Core\Entity\EntityStorageInterface;
|
||||||
use Drupal\Core\Field\BaseFieldDefinition;
|
use Drupal\Core\Field\BaseFieldDefinition;
|
||||||
@ -13,28 +13,28 @@ use Drupal\user\UserInterface;
|
|||||||
/**
|
/**
|
||||||
* Defines the Case entity.
|
* Defines the Case entity.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*
|
*
|
||||||
* @ContentEntityType(
|
* @ContentEntityType(
|
||||||
* id = "oc_case",
|
* id = "oc_case",
|
||||||
* label = @Translation("Case"),
|
* label = @Translation("Case"),
|
||||||
* bundle_label = @Translation("Case type"),
|
* bundle_label = @Translation("Case type"),
|
||||||
* handlers = {
|
* handlers = {
|
||||||
* "storage" = "Drupal\opencase_entities\OCCaseStorage",
|
* "storage" = "Drupal\opencase_cases\OCCaseStorage",
|
||||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||||
* "list_builder" = "Drupal\opencase_entities\OCCaseListBuilder",
|
* "list_builder" = "Drupal\opencase_cases\OCCaseListBuilder",
|
||||||
* "views_data" = "Drupal\opencase_entities\Entity\OCCaseViewsData",
|
* "views_data" = "Drupal\opencase_cases\Entity\OCCaseViewsData",
|
||||||
* "translation" = "Drupal\opencase_entities\OCCaseTranslationHandler",
|
* "translation" = "Drupal\opencase_cases\OCCaseTranslationHandler",
|
||||||
*
|
*
|
||||||
* "form" = {
|
* "form" = {
|
||||||
* "default" = "Drupal\opencase_entities\Form\OCCaseForm",
|
* "default" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||||
* "add" = "Drupal\opencase_entities\Form\OCCaseForm",
|
* "add" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||||
* "edit" = "Drupal\opencase_entities\Form\OCCaseForm",
|
* "edit" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||||
* "delete" = "Drupal\opencase_entities\Form\OCCaseDeleteForm",
|
* "delete" = "Drupal\opencase_cases\Form\OCCaseDeleteForm",
|
||||||
* },
|
* },
|
||||||
* "access" = "Drupal\opencase_entities\OCCaseAccessControlHandler",
|
* "access" = "Drupal\opencase_cases\OCCaseAccessControlHandler",
|
||||||
* "route_provider" = {
|
* "route_provider" = {
|
||||||
* "html" = "Drupal\opencase_entities\OCCaseHtmlRouteProvider",
|
* "html" = "Drupal\opencase_cases\OCCaseHtmlRouteProvider",
|
||||||
* },
|
* },
|
||||||
* },
|
* },
|
||||||
* base_table = "oc_case",
|
* base_table = "oc_case",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Entity;
|
namespace Drupal\opencase_cases\Entity;
|
||||||
|
|
||||||
use Drupal\Core\Entity\ContentEntityInterface;
|
use Drupal\Core\Entity\ContentEntityInterface;
|
||||||
use Drupal\Core\Entity\RevisionLogInterface;
|
use Drupal\Core\Entity\RevisionLogInterface;
|
||||||
@ -10,7 +10,7 @@ use Drupal\user\EntityOwnerInterface;
|
|||||||
/**
|
/**
|
||||||
* Provides an interface for defining Case entities.
|
* Provides an interface for defining Case entities.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface {
|
interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface {
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* The Case name.
|
* The Case name.
|
||||||
*
|
*
|
||||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||||
* The called Case entity.
|
* The called Case entity.
|
||||||
*/
|
*/
|
||||||
public function setName($name);
|
public function setName($name);
|
||||||
@ -49,7 +49,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
|||||||
* @param int $timestamp
|
* @param int $timestamp
|
||||||
* The Case creation timestamp.
|
* The Case creation timestamp.
|
||||||
*
|
*
|
||||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||||
* The called Case entity.
|
* The called Case entity.
|
||||||
*/
|
*/
|
||||||
public function setCreatedTime($timestamp);
|
public function setCreatedTime($timestamp);
|
||||||
@ -70,7 +70,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
|||||||
* @param bool $published
|
* @param bool $published
|
||||||
* TRUE to set this Case to published, FALSE to set it to unpublished.
|
* 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.
|
* The called Case entity.
|
||||||
*/
|
*/
|
||||||
public function setPublished($published);
|
public function setPublished($published);
|
||||||
@ -89,7 +89,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
|||||||
* @param int $timestamp
|
* @param int $timestamp
|
||||||
* The UNIX timestamp of when this revision was created.
|
* 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.
|
* The called Case entity.
|
||||||
*/
|
*/
|
||||||
public function setRevisionCreationTime($timestamp);
|
public function setRevisionCreationTime($timestamp);
|
||||||
@ -108,7 +108,7 @@ interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface,
|
|||||||
* @param int $uid
|
* @param int $uid
|
||||||
* The user ID of the revision author.
|
* The user ID of the revision author.
|
||||||
*
|
*
|
||||||
* @return \Drupal\opencase_entities\Entity\OCCaseInterface
|
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||||
* The called Case entity.
|
* The called Case entity.
|
||||||
*/
|
*/
|
||||||
public function setRevisionUserId($uid);
|
public function setRevisionUserId($uid);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Entity;
|
namespace Drupal\opencase_cases\Entity;
|
||||||
|
|
||||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||||
|
|
||||||
@ -11,16 +11,16 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
|||||||
* id = "oc_case_type",
|
* id = "oc_case_type",
|
||||||
* label = @Translation("Case type"),
|
* label = @Translation("Case type"),
|
||||||
* handlers = {
|
* handlers = {
|
||||||
* "access" = "Drupal\opencase_entities\OCCaseTypeAccessControlHandler",
|
* "access" = "Drupal\opencase_cases\OCCaseTypeAccessControlHandler",
|
||||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||||
* "list_builder" = "Drupal\opencase_entities\OCCaseTypeListBuilder",
|
* "list_builder" = "Drupal\opencase_cases\OCCaseTypeListBuilder",
|
||||||
* "form" = {
|
* "form" = {
|
||||||
* "add" = "Drupal\opencase_entities\Form\OCCaseTypeForm",
|
* "add" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
|
||||||
* "edit" = "Drupal\opencase_entities\Form\OCCaseTypeForm",
|
* "edit" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
|
||||||
* "delete" = "Drupal\opencase_entities\Form\OCCaseTypeDeleteForm"
|
* "delete" = "Drupal\opencase_cases\Form\OCCaseTypeDeleteForm"
|
||||||
* },
|
* },
|
||||||
* "route_provider" = {
|
* "route_provider" = {
|
||||||
* "html" = "Drupal\opencase_entities\OCCaseTypeHtmlRouteProvider",
|
* "html" = "Drupal\opencase_cases\OCCaseTypeHtmlRouteProvider",
|
||||||
* },
|
* },
|
||||||
* },
|
* },
|
||||||
* config_prefix = "oc_case_type",
|
* config_prefix = "oc_case_type",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Entity;
|
namespace Drupal\opencase_cases\Entity;
|
||||||
|
|
||||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Entity;
|
namespace Drupal\opencase_cases\Entity;
|
||||||
|
|
||||||
use Drupal\views\EntityViewsData;
|
use Drupal\views\EntityViewsData;
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a form for deleting Case entities.
|
* Provides a form for deleting Case entities.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseDeleteForm extends ContentEntityDeleteForm {
|
class OCCaseDeleteForm extends ContentEntityDeleteForm {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Entity\ContentEntityForm;
|
use Drupal\Core\Entity\ContentEntityForm;
|
||||||
use Drupal\Core\Form\FormStateInterface;
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
@ -8,7 +8,7 @@ use Drupal\Core\Form\FormStateInterface;
|
|||||||
/**
|
/**
|
||||||
* Form controller for Case edit forms.
|
* Form controller for Case edit forms.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseForm extends ContentEntityForm {
|
class OCCaseForm extends ContentEntityForm {
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ class OCCaseForm extends ContentEntityForm {
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
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);
|
$form = parent::buildForm($form, $form_state);
|
||||||
|
|
||||||
if (!$this->entity->isNew()) {
|
if (!$this->entity->isNew()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Database\Connection;
|
use Drupal\Core\Database\Connection;
|
||||||
use Drupal\Core\Entity\EntityStorageInterface;
|
use Drupal\Core\Entity\EntityStorageInterface;
|
||||||
@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||||||
/**
|
/**
|
||||||
* Provides a form for deleting a Case revision.
|
* Provides a form for deleting a Case revision.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseRevisionDeleteForm extends ConfirmFormBase {
|
class OCCaseRevisionDeleteForm extends ConfirmFormBase {
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class OCCaseRevisionDeleteForm extends ConfirmFormBase {
|
|||||||
/**
|
/**
|
||||||
* The Case revision.
|
* The Case revision.
|
||||||
*
|
*
|
||||||
* @var \Drupal\opencase_entities\Entity\OCCaseInterface
|
* @var \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||||
*/
|
*/
|
||||||
protected $revision;
|
protected $revision;
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||||
use Drupal\Core\Entity\EntityStorageInterface;
|
use Drupal\Core\Entity\EntityStorageInterface;
|
||||||
use Drupal\Core\Form\ConfirmFormBase;
|
use Drupal\Core\Form\ConfirmFormBase;
|
||||||
use Drupal\Core\Form\FormStateInterface;
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
use Drupal\Core\Url;
|
use Drupal\Core\Url;
|
||||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a form for reverting a Case revision.
|
* Provides a form for reverting a Case revision.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
|||||||
/**
|
/**
|
||||||
* The Case revision.
|
* The Case revision.
|
||||||
*
|
*
|
||||||
* @var \Drupal\opencase_entities\Entity\OCCaseInterface
|
* @var \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||||
*/
|
*/
|
||||||
protected $revision;
|
protected $revision;
|
||||||
|
|
||||||
@ -130,12 +130,12 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
|||||||
/**
|
/**
|
||||||
* Prepares a revision to be reverted.
|
* 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.
|
* The revision to be reverted.
|
||||||
* @param \Drupal\Core\Form\FormStateInterface $form_state
|
* @param \Drupal\Core\Form\FormStateInterface $form_state
|
||||||
* The current state of the form.
|
* 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.
|
* The prepared revision ready to be stored.
|
||||||
*/
|
*/
|
||||||
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||||
use Drupal\Core\Entity\EntityStorageInterface;
|
use Drupal\Core\Entity\EntityStorageInterface;
|
||||||
use Drupal\Core\Form\FormStateInterface;
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
use Drupal\Core\Language\LanguageManagerInterface;
|
use Drupal\Core\Language\LanguageManagerInterface;
|
||||||
use Drupal\opencase_entities\Entity\OCCaseInterface;
|
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a form for reverting a Case revision for a single translation.
|
* Provides a form for reverting a Case revision for a single translation.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
|
class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
|
|||||||
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
||||||
$revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields');
|
$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 = $this->OCCaseStorage->load($revision->id());
|
||||||
$latest_revision_translation = $latest_revision->getTranslation($this->langcode);
|
$latest_revision_translation = $latest_revision->getTranslation($this->langcode);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Form\FormBase;
|
use Drupal\Core\Form\FormBase;
|
||||||
use Drupal\Core\Form\FormStateInterface;
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
@ -8,7 +8,7 @@ use Drupal\Core\Form\FormStateInterface;
|
|||||||
/**
|
/**
|
||||||
* Class OCCaseSettingsForm.
|
* Class OCCaseSettingsForm.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseSettingsForm extends FormBase {
|
class OCCaseSettingsForm extends FormBase {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||||
use Drupal\Core\Form\FormStateInterface;
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities\Form;
|
namespace Drupal\opencase_cases\Form;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityForm;
|
use Drupal\Core\Entity\EntityForm;
|
||||||
use Drupal\Core\Form\FormStateInterface;
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
@ -30,7 +30,7 @@ class OCCaseTypeForm extends EntityForm {
|
|||||||
'#type' => 'machine_name',
|
'#type' => 'machine_name',
|
||||||
'#default_value' => $oc_case_type->id(),
|
'#default_value' => $oc_case_type->id(),
|
||||||
'#machine_name' => [
|
'#machine_name' => [
|
||||||
'exists' => '\Drupal\opencase_entities\Entity\OCCaseType::load',
|
'exists' => '\Drupal\opencase_cases\Entity\OCCaseType::load',
|
||||||
],
|
],
|
||||||
'#disabled' => !$oc_case_type->isNew(),
|
'#disabled' => !$oc_case_type->isNew(),
|
||||||
];
|
];
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityAccessControlHandler;
|
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||||
use Drupal\Core\Entity\EntityInterface;
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
use Drupal\Core\Session\AccountInterface;
|
use Drupal\Core\Session\AccountInterface;
|
||||||
use Drupal\Core\Access\AccessResult;
|
use Drupal\Core\Access\AccessResult;
|
||||||
use Drupal\opencase_entities\CaseInvolvement;
|
use Drupal\opencase_cases\CaseInvolvement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access controller for the Case entity.
|
* Access controller for the Case entity.
|
||||||
*
|
*
|
||||||
* @see \Drupal\opencase_entities\Entity\OCCase.
|
* @see \Drupal\opencase_cases\Entity\OCCase.
|
||||||
*/
|
*/
|
||||||
class OCCaseAccessControlHandler extends EntityAccessControlHandler {
|
class OCCaseAccessControlHandler extends EntityAccessControlHandler {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ class OCCaseAccessControlHandler extends EntityAccessControlHandler {
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||||
/** @var \Drupal\opencase_entities\Entity\OCCaseInterface $entity */
|
/** @var \Drupal\opencase_cases\Entity\OCCaseInterface $entity */
|
||||||
switch ($operation) {
|
switch ($operation) {
|
||||||
case 'view':
|
case 'view':
|
||||||
if (!$entity->isPublished()) {
|
if (!$entity->isPublished()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityTypeInterface;
|
use Drupal\Core\Entity\EntityTypeInterface;
|
||||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||||
@ -64,7 +64,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
|||||||
$route
|
$route
|
||||||
->setDefaults([
|
->setDefaults([
|
||||||
'_title' => "{$entity_type->getLabel()} revisions",
|
'_title' => "{$entity_type->getLabel()} revisions",
|
||||||
'_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionOverview',
|
'_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionOverview',
|
||||||
])
|
])
|
||||||
->setRequirement('_permission', 'access case revisions')
|
->setRequirement('_permission', 'access case revisions')
|
||||||
->setOption('_admin_route', TRUE);
|
->setOption('_admin_route', TRUE);
|
||||||
@ -87,8 +87,8 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
|||||||
$route = new Route($entity_type->getLinkTemplate('revision'));
|
$route = new Route($entity_type->getLinkTemplate('revision'));
|
||||||
$route
|
$route
|
||||||
->setDefaults([
|
->setDefaults([
|
||||||
'_controller' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionShow',
|
'_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionShow',
|
||||||
'_title_callback' => '\Drupal\opencase_entities\Controller\OCCaseController::revisionPageTitle',
|
'_title_callback' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionPageTitle',
|
||||||
])
|
])
|
||||||
->setRequirement('_permission', 'access case revisions')
|
->setRequirement('_permission', 'access case revisions')
|
||||||
->setOption('_admin_route', TRUE);
|
->setOption('_admin_route', TRUE);
|
||||||
@ -111,7 +111,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
|||||||
$route = new Route($entity_type->getLinkTemplate('revision_revert'));
|
$route = new Route($entity_type->getLinkTemplate('revision_revert'));
|
||||||
$route
|
$route
|
||||||
->setDefaults([
|
->setDefaults([
|
||||||
'_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertForm',
|
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertForm',
|
||||||
'_title' => 'Revert to earlier revision',
|
'_title' => 'Revert to earlier revision',
|
||||||
])
|
])
|
||||||
->setRequirement('_permission', 'revert all case revisions')
|
->setRequirement('_permission', 'revert all case revisions')
|
||||||
@ -135,7 +135,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
|||||||
$route = new Route($entity_type->getLinkTemplate('revision_delete'));
|
$route = new Route($entity_type->getLinkTemplate('revision_delete'));
|
||||||
$route
|
$route
|
||||||
->setDefaults([
|
->setDefaults([
|
||||||
'_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionDeleteForm',
|
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionDeleteForm',
|
||||||
'_title' => 'Delete earlier revision',
|
'_title' => 'Delete earlier revision',
|
||||||
])
|
])
|
||||||
->setRequirement('_permission', 'delete all case revisions')
|
->setRequirement('_permission', 'delete all case revisions')
|
||||||
@ -159,7 +159,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
|||||||
$route = new Route($entity_type->getLinkTemplate('translation_revert'));
|
$route = new Route($entity_type->getLinkTemplate('translation_revert'));
|
||||||
$route
|
$route
|
||||||
->setDefaults([
|
->setDefaults([
|
||||||
'_form' => '\Drupal\opencase_entities\Form\OCCaseRevisionRevertTranslationForm',
|
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertTranslationForm',
|
||||||
'_title' => 'Revert to earlier revision of a translation',
|
'_title' => 'Revert to earlier revision of a translation',
|
||||||
])
|
])
|
||||||
->setRequirement('_permission', 'revert all case revisions')
|
->setRequirement('_permission', 'revert all case revisions')
|
||||||
@ -183,7 +183,7 @@ class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
|||||||
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
|
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
|
||||||
$route
|
$route
|
||||||
->setDefaults([
|
->setDefaults([
|
||||||
'_form' => 'Drupal\opencase_entities\Form\OCCaseSettingsForm',
|
'_form' => 'Drupal\opencase_cases\Form\OCCaseSettingsForm',
|
||||||
'_title' => "{$entity_type->getLabel()} settings",
|
'_title' => "{$entity_type->getLabel()} settings",
|
||||||
])
|
])
|
||||||
->setRequirement('_permission', $entity_type->getAdminPermission())
|
->setRequirement('_permission', $entity_type->getAdminPermission())
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityInterface;
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
use Drupal\Core\Entity\EntityListBuilder;
|
use Drupal\Core\Entity\EntityListBuilder;
|
||||||
@ -9,7 +9,7 @@ use Drupal\Core\Link;
|
|||||||
/**
|
/**
|
||||||
* Defines a class to build a listing of Case entities.
|
* Defines a class to build a listing of Case entities.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseListBuilder extends EntityListBuilder {
|
class OCCaseListBuilder extends EntityListBuilder {
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ class OCCaseListBuilder extends EntityListBuilder {
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function buildRow(EntityInterface $entity) {
|
public function buildRow(EntityInterface $entity) {
|
||||||
/* @var $entity \Drupal\opencase_entities\Entity\OCCase */
|
/* @var $entity \Drupal\opencase_cases\Entity\OCCase */
|
||||||
$row['id'] = $entity->id();
|
$row['id'] = $entity->id();
|
||||||
$row['name'] = Link::createFromRoute(
|
$row['name'] = Link::createFromRoute(
|
||||||
$entity->label(),
|
$entity->label(),
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
|
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
|
||||||
use Drupal\Core\Session\AccountInterface;
|
use Drupal\Core\Session\AccountInterface;
|
||||||
use Drupal\Core\Language\LanguageInterface;
|
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.
|
* 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
|
* This extends the base storage class, adding required special handling for
|
||||||
* Case entities.
|
* Case entities.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
class OCCaseStorage extends SqlContentEntityStorage implements OCCaseStorageInterface {
|
class OCCaseStorage extends SqlContentEntityStorage implements OCCaseStorageInterface {
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Entity\ContentEntityStorageInterface;
|
use Drupal\Core\Entity\ContentEntityStorageInterface;
|
||||||
use Drupal\Core\Session\AccountInterface;
|
use Drupal\Core\Session\AccountInterface;
|
||||||
use Drupal\Core\Language\LanguageInterface;
|
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.
|
* 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
|
* This extends the base storage class, adding required special handling for
|
||||||
* Case entities.
|
* Case entities.
|
||||||
*
|
*
|
||||||
* @ingroup opencase_entities
|
* @ingroup opencase_cases
|
||||||
*/
|
*/
|
||||||
interface OCCaseStorageInterface extends ContentEntityStorageInterface {
|
interface OCCaseStorageInterface extends ContentEntityStorageInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of Case revision IDs for a specific Case.
|
* 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.
|
* The Case entity.
|
||||||
*
|
*
|
||||||
* @return int[]
|
* @return int[]
|
||||||
@ -42,7 +42,7 @@ interface OCCaseStorageInterface extends ContentEntityStorageInterface {
|
|||||||
/**
|
/**
|
||||||
* Counts the number of revisions in the default language.
|
* 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.
|
* The Case entity.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\content_translation\ContentTranslationHandler;
|
use Drupal\content_translation\ContentTranslationHandler;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityAccessControlHandler;
|
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||||
use Drupal\Core\Session\AccountInterface;
|
use Drupal\Core\Session\AccountInterface;
|
||||||
@ -11,7 +11,7 @@ use Drupal\Core\Access\AccessResult;
|
|||||||
* Defines the access control handler for the OCCaseType Config Entity.
|
* Defines the access control handler for the OCCaseType Config Entity.
|
||||||
* Always allows viewing the label of the bundle.
|
* Always allows viewing the label of the bundle.
|
||||||
*
|
*
|
||||||
* @see Drupal\opencase_entities\Entity\OCCaseType
|
* @see Drupal\opencase_cases\Entity\OCCaseType
|
||||||
*/
|
*/
|
||||||
class OCCaseTypeAccessControlHandler extends EntityAccessControlHandler {
|
class OCCaseTypeAccessControlHandler extends EntityAccessControlHandler {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityTypeInterface;
|
use Drupal\Core\Entity\EntityTypeInterface;
|
||||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\opencase_entities;
|
namespace Drupal\opencase_cases;
|
||||||
|
|
||||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||||
use Drupal\Core\Entity\EntityInterface;
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
|
Reference in New Issue
Block a user