projects
/
yaffs-website
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website]
/
web
/
core
/
modules
/
comment
/
src
/
Entity
/
Comment.php
diff --git
a/web/core/modules/comment/src/Entity/Comment.php
b/web/core/modules/comment/src/Entity/Comment.php
index 233c752c59f6bcacd327512f20f00dd895eb7e27..e0745d3da0e3d67b1a798ef646c49dc6aec96f43 100644
(file)
--- a/
web/core/modules/comment/src/Entity/Comment.php
+++ b/
web/core/modules/comment/src/Entity/Comment.php
@@
-56,6
+56,7
@@
use Drupal\user\UserInterface;
* links = {
* "canonical" = "/comment/{comment}",
* "delete-form" = "/comment/{comment}/delete",
* links = {
* "canonical" = "/comment/{comment}",
* "delete-form" = "/comment/{comment}/delete",
+ * "delete-multiple-form" = "/admin/content/comment/delete",
* "edit-form" = "/comment/{comment}/edit",
* "create" = "/comment",
* },
* "edit-form" = "/comment/{comment}/edit",
* "create" = "/comment",
* },
@@
-142,10
+143,6
@@
class Comment extends ContentEntityBase implements CommentInterface {
$this->threadLock = $lock_name;
}
$this->setThread($thread);
$this->threadLock = $lock_name;
}
$this->setThread($thread);
- if (!$this->getHostname()) {
- // Ensure a client host from the current request.
- $this->setHostname(\Drupal::request()->getClientIP());
- }
}
// The entity fields for name and mail have no meaning if the user is not
// Anonymous. Set them to NULL to make it clearer that they are not used.
}
// The entity fields for name and mail have no meaning if the user is not
// Anonymous. Set them to NULL to make it clearer that they are not used.
@@
-290,7
+287,8
@@
class Comment extends ContentEntityBase implements CommentInterface {
->setLabel(t('Hostname'))
->setDescription(t("The comment author's hostname."))
->setTranslatable(TRUE)
->setLabel(t('Hostname'))
->setDescription(t("The comment author's hostname."))
->setTranslatable(TRUE)
- ->setSetting('max_length', 128);
+ ->setSetting('max_length', 128)
+ ->setDefaultValueCallback(static::class . '::getDefaultHostname');
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
@@
-571,4
+569,14
@@
class Comment extends ContentEntityBase implements CommentInterface {
return \Drupal::currentUser()->hasPermission('skip comment approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED;
}
return \Drupal::currentUser()->hasPermission('skip comment approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED;
}
+ /**
+ * Returns the default value for entity hostname base field.
+ *
+ * @return string
+ * The client host name.
+ */
+ public static function getDefaultHostname() {
+ return \Drupal::request()->getClientIP();
+ }
+
}
}