Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/module/src/Controller/entity-controller.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn
if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
$username = [
'#theme' => 'username',
'#account' => $revision->getRevisionAuthor(),
'#account' => $revision->getRevisionUser(),
];

// Use revision link to link to revisions that are not active.
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Entity/Form/entity-content.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class {{ entity_class }}Form extends ContentEntityForm {% endblock %}

// If a new revision is created, save the current user as revision author.
$entity->setRevisionCreationTime(REQUEST_TIME);
$entity->setRevisionAuthorId(\Drupal::currentUser()->id());
$entity->setRevisionUserId(\Drupal::currentUser()->id());
}
else {
$entity->setNewRevision(FALSE);
Expand Down
8 changes: 4 additions & 4 deletions templates/module/src/Entity/entity-content.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB

// If no revision author has been set explicitly, make the {{ entity_name }} owner the
// revision author.
if (!$this->getRevisionAuthor()) {
$this->setRevisionAuthorId($this->getOwnerId());
if (!$this->getRevisionUser()) {
$this->setRevisionUserId($this->getOwnerId());
}
}
{% endif %}
Expand Down Expand Up @@ -255,14 +255,14 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB
/**
* {@inheritdoc}
*/
public function getRevisionAuthor() {
public function getRevisionUser() {
return $this->get('revision_uid')->entity;
}

/**
* {@inheritdoc}
*/
public function setRevisionAuthorId($uid) {
public function setRevisionUserId($uid) {
$this->set('revision_uid', $uid);
return $this;
}
Expand Down
7 changes: 4 additions & 3 deletions templates/module/src/Entity/interface-entity-content.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Drupal\{{module}}\Entity;

{% block use_class %}
{% if revisionable %}
use Drupal\Core\Entity\RevisionLogInterface;
use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Url;
Expand All @@ -26,7 +27,7 @@ use Drupal\user\EntityOwnerInterface;
*
* @ingroup {{module}}
*/
interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableInterface{% else %} ContentEntityInterface{% endif %}, EntityChangedInterface, EntityOwnerInterface {% endblock %}
interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableInterface, RevisionLogInterface{% else %} ContentEntityInterface{% endif %}, EntityChangedInterface, EntityOwnerInterface {% endblock %}
{% block class_methods %}
// Add get/set methods for your configuration properties here.

Expand Down Expand Up @@ -125,7 +126,7 @@ interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableI
* @return \Drupal\user\UserInterface
* The user entity for the revision author.
*/
public function getRevisionAuthor();
public function getRevisionUser();

/**
* Sets the {{ label }} revision author.
Expand All @@ -136,6 +137,6 @@ interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableI
* @return \Drupal\{{ module }}\Entity\{{ entity_class }}Interface
* The called {{ label }} entity.
*/
public function setRevisionAuthorId($uid);
public function setRevisionUserId($uid);
{% endif %}
{% endblock %}