fixed deprecated functions
This commit is contained in:
parent
225e92a51c
commit
13ddf5aa13
@ -25,8 +25,8 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
||||
* An array suitable for drupal_render().
|
||||
*/
|
||||
public function revisionShow($oc_case_revision) {
|
||||
$oc_case = $this->entityManager()->getStorage('oc_case')->loadRevision($oc_case_revision);
|
||||
$view_builder = $this->entityManager()->getViewBuilder('oc_case');
|
||||
$oc_case = $this->entityTypeManager()->getStorage('oc_case')->loadRevision($oc_case_revision);
|
||||
$view_builder = $this->entityTypeManager()->getViewBuilder('oc_case');
|
||||
|
||||
return $view_builder->view($oc_case);
|
||||
}
|
||||
@ -41,8 +41,10 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
||||
* The page title.
|
||||
*/
|
||||
public function revisionPageTitle($oc_case_revision) {
|
||||
$oc_case = $this->entityManager()->getStorage('oc_case')->loadRevision($oc_case_revision);
|
||||
return $this->t('Revision of %title from %date', ['%title' => $oc_case->label(), '%date' => format_date($oc_case->getRevisionCreationTime())]);
|
||||
$oc_case = $this->entityTypeManager()->getStorage('oc_case')->loadRevision($oc_case_revision);
|
||||
|
||||
$date = \Drupal::service('date.formatter')->format($oc_case->getRevisionCreationTime());
|
||||
return $this->t('Revision of %title from %date', ['%title' => $oc_case->label(), '%date' => $date]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +62,7 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
||||
$langname = $oc_case->language()->getName();
|
||||
$languages = $oc_case->getTranslationLanguages();
|
||||
$has_translations = (count($languages) > 1);
|
||||
$oc_case_storage = $this->entityManager()->getStorage('oc_case');
|
||||
$oc_case_storage = $this->entityTypeManager()->getStorage('oc_case');
|
||||
|
||||
$build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $oc_case->label()]) : $this->t('Revisions for %title', ['%title' => $oc_case->label()]);
|
||||
$header = [$this->t('Revision'), $this->t('Operations')];
|
||||
@ -88,10 +90,11 @@ class OCCaseController extends ControllerBase implements ContainerInjectionInter
|
||||
// Use revision link to link to revisions that are not active.
|
||||
$date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short');
|
||||
if ($vid != $oc_case->getRevisionId()) {
|
||||
$link = $this->l($date, new Url('entity.oc_case.revision', ['oc_case' => $oc_case->id(), 'oc_case_revision' => $vid]));
|
||||
$url = new Url('entity.oc_case.revision', ['oc_case' => $oc_case->id(), 'oc_case_revision' => $vid]);
|
||||
$link = \Drupal\Core\Link::fromTextAndUrl($date, $url)->toString();
|
||||
}
|
||||
else {
|
||||
$link = $oc_case->link($date);
|
||||
$link = $oc_case->toLink($date)->toString();
|
||||
}
|
||||
|
||||
$row = [];
|
||||
|
@ -118,13 +118,14 @@ class OCCaseFeeController extends ControllerBase implements ContainerInjectionIn
|
||||
// Use revision link to link to revisions that are not active.
|
||||
$date = $this->dateFormatter->format($revision->getRevisionCreationTime(), 'short');
|
||||
if ($vid != $oc_case_fee->getRevisionId()) {
|
||||
$link = $this->l($date, new Url('entity.oc_case_fee.revision', [
|
||||
$url = new Url('entity.oc_case_fee.revision', [
|
||||
'oc_case_fee' => $oc_case_fee->id(),
|
||||
'oc_case_fee_revision' => $vid,
|
||||
]));
|
||||
]);
|
||||
$link = \Drupal\Core\Link::fromTextAndUrl($date, $url)->toString();
|
||||
}
|
||||
else {
|
||||
$link = $oc_case_fee->link($date);
|
||||
$link = $oc_case_fee->toLink($date)->toString();
|
||||
}
|
||||
|
||||
$row = [];
|
||||
|
@ -118,13 +118,14 @@ class OCCaseProvisionController extends ControllerBase implements ContainerInjec
|
||||
// Use revision link to link to revisions that are not active.
|
||||
$date = $this->dateFormatter->format($revision->getRevisionCreationTime(), 'short');
|
||||
if ($vid != $oc_case_provision->getRevisionId()) {
|
||||
$link = $this->l($date, new Url('entity.oc_case_provision.revision', [
|
||||
$url = new Url('entity.oc_case_provision.revision', [
|
||||
'oc_case_provision' => $oc_case_provision->id(),
|
||||
'oc_case_provision_revision' => $vid,
|
||||
]));
|
||||
]);
|
||||
$link = \Drupal\Core\Link::fromTextAndUrl($date, $url)->toString();
|
||||
}
|
||||
else {
|
||||
$link = $oc_case_provision->link($date);
|
||||
$link = $oc_case_provision->toLink($date)->toString();
|
||||
}
|
||||
|
||||
$row = [];
|
||||
|
@ -5,6 +5,7 @@ namespace Drupal\opencase_entities\Controller;
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\Link;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\opencase_entities\Entity\OCActivityInterface;
|
||||
|
||||
@ -25,8 +26,8 @@ class OCActivityController extends ControllerBase implements ContainerInjectionI
|
||||
* An array suitable for drupal_render().
|
||||
*/
|
||||
public function revisionShow($oc_activity_revision) {
|
||||
$oc_activity = $this->entityManager()->getStorage('oc_activity')->loadRevision($oc_activity_revision);
|
||||
$view_builder = $this->entityManager()->getViewBuilder('oc_activity');
|
||||
$oc_activity = $this->entityTypeManager()->getStorage('oc_activity')->loadRevision($oc_activity_revision);
|
||||
$view_builder = $this->entityTypeManager()->getViewBuilder('oc_activity');
|
||||
|
||||
return $view_builder->view($oc_activity);
|
||||
}
|
||||
@ -41,7 +42,7 @@ class OCActivityController extends ControllerBase implements ContainerInjectionI
|
||||
* The page title.
|
||||
*/
|
||||
public function revisionPageTitle($oc_activity_revision) {
|
||||
$oc_activity = $this->entityManager()->getStorage('oc_activity')->loadRevision($oc_activity_revision);
|
||||
$oc_activity = $this->entityTypeManager()->getStorage('oc_activity')->loadRevision($oc_activity_revision);
|
||||
return $this->t('Revision of %title from %date', ['%title' => $oc_activity->label(), '%date' => format_date($oc_activity->getRevisionCreationTime())]);
|
||||
}
|
||||
|
||||
@ -60,7 +61,7 @@ class OCActivityController extends ControllerBase implements ContainerInjectionI
|
||||
$langname = $oc_activity->language()->getName();
|
||||
$languages = $oc_activity->getTranslationLanguages();
|
||||
$has_translations = (count($languages) > 1);
|
||||
$oc_activity_storage = $this->entityManager()->getStorage('oc_activity');
|
||||
$oc_activity_storage = $this->entityTypeManager()->getStorage('oc_activity');
|
||||
|
||||
$build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $oc_activity->label()]) : $this->t('Revisions for %title', ['%title' => $oc_activity->label()]);
|
||||
$header = [$this->t('Revision'), $this->t('Operations')];
|
||||
@ -88,10 +89,11 @@ class OCActivityController extends ControllerBase implements ContainerInjectionI
|
||||
// Use revision link to link to revisions that are not active.
|
||||
$date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short');
|
||||
if ($vid != $oc_activity->getRevisionId()) {
|
||||
$link = $this->l($date, new Url('entity.oc_activity.revision', ['oc_activity' => $oc_activity->id(), 'oc_activity_revision' => $vid]));
|
||||
$url = new Url('entity.oc_activity.revision', ['oc_activity' => $oc_activity->id(), 'oc_activity_revision' => $vid]);
|
||||
$link = \Drupal\Core\Link::fromTextAndUrl($date, $url)->toString();
|
||||
}
|
||||
else {
|
||||
$link = $oc_activity->link($date);
|
||||
$link = $oc_activity->toLink($date)->toString();
|
||||
}
|
||||
|
||||
$row = [];
|
||||
|
@ -118,10 +118,11 @@ class OCOrganisationController extends ControllerBase implements ContainerInject
|
||||
// Use revision link to link to revisions that are not active.
|
||||
$date = $this->dateFormatter->format($revision->getRevisionCreationTime(), 'short');
|
||||
if ($vid != $oc_organisation->getRevisionId()) {
|
||||
$link = $this->l($date, new Url('entity.oc_organisation.revision', [
|
||||
$url = new Url('entity.oc_organisation.revision', [
|
||||
'oc_organisation' => $oc_organisation->id(),
|
||||
'oc_organisation_revision' => $vid,
|
||||
]));
|
||||
]);
|
||||
$link = \Drupal\Core\Link::fromTextAndUrl($date,$url)->toString();
|
||||
}
|
||||
else {
|
||||
$link = $oc_organisation->toLink($date)->toString();
|
||||
|
Reference in New Issue
Block a user