Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 Sep 2014 at 09:36 UTC
Updated:
28 Oct 2014 at 12:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yesct commented+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php
@@ -109,10 +109,11 @@ public function isSyncing();
* entity change is part of an uninstall process, and skip executing your code
* if that is the case.
*
- * For example, \Drupal\language\Entity\ConfigurableLanguage::preDelete()
- * prevents the API from deleting the default language. However during an
- * uninstall of the language module it is expected that the default language
- * should be deleted.
+ * For example,
+ * \Drupal\language\Entity\ConfigurableLanguageInterface::preDelete() prevents
+ * the API from deleting the default language. However during an uninstall of
+ * the language module it is expected that the default language should be
+ * deleted.
Comment #2
yesct commentedtaking out from #2226533: Changes to the Language class due to the LanguageInterface (followup)
diff --git a/core/modules/language/src/Entity/ConfigurableLanguage.php b/core/modules/language/src/Entity/ConfigurableLanguage.php
index eda4d9a..1a429c6 100644
--- a/core/modules/language/src/Entity/ConfigurableLanguage.php
+++ b/core/modules/language/src/Entity/ConfigurableLanguage.php
@@ -87,9 +87,9 @@ class ConfigurableLanguage extends ConfigEntityBase implements ConfigurableLangu
* container using the language.default service in when the entity is saved.
* The value is set correctly when a language entity is created or loaded.
*
- * @see \Drupal\language\Entity\ConfigurableLanguage::postSave()
- * @see \Drupal\language\Entity\ConfigurableLanguage::isDefault()
- * @see \Drupal\language\Entity\ConfigurableLanguage::setDefault()
+ * @see \Drupal\language\Entity\ConfigurableLanguageInterface::postSave()
+ * @see \Drupal\language\Entity\ConfigurableLanguageInterface::isDefault()
+ * @see \Drupal\language\Entity\ConfigurableLanguageInterface::setDefault()
*
* @var bool
*/
@@ -101,8 +101,8 @@ class ConfigurableLanguage extends ConfigEntityBase implements ConfigurableLangu
* This property is not saved to the language entity, but is needed for
* detecting when to rebuild the services.
*
- * @see \Drupal\language\Entity\ConfigurableLanguage::preSave()
- * @see \Drupal\language\Entity\ConfigurableLanguage::postSave()
+ * @see \Drupal\language\Entity\ConfigurableLanguageInterface::preSave()
+ * @see \Drupal\language\Entity\ConfigurableLanguageInterface::postSave()
*
* @var bool
*/
@@ -148,7 +148,7 @@ public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
// Store whether or not the site is already multilingual so that we can
// rebuild services if necessary during
- // \Drupal\language\Entity\ConfigurableLanguage::postSave().
+ // \Drupal\language\Entity\ConfigurableLanguageInterface::postSave().
$this->preSaveMultilingual = \Drupal::languageManager()->isMultilingual();
// Languages are picked from a predefined list which is given in English.
// For the uncommon case of custom languages the label should be given in
@@ -319,4 +319,11 @@ public function setNegotiationMethodId($method_id) {
return $this;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function isLocked() {
+ return !empty($this->locked);
+ }
+
}
I would have thought #2246679: Make Language module's LanguageInterface (to be ConfigurableLanguageInterface) extend Core's LanguageInterface would have taken care of this if it is needed.
look at the addition of isLocked() (later).
Comment #3
yesct commentedand... in LanguageConfigurationElementTest
@@ -99,7 +99,7 @@ public function testDefaultLangcode() {
$this->assertFalse($configurable_language->get('default'), 'The en language entity is not flagged as the default language.');
$configurable_language = entity_load('configurable_language', 'cc');
// Check calling the
- // \Drupal\language\Entity\ConfigurableLanguage::isDefault() method
+ // \Drupal\language\Entity\ConfigurableLanguageInterface::isDefault() method
// directly.
$this->assertTrue($configurable_language->isDefault(), 'The cc language entity is flagged as the default language.');
Comment #4
martin107 commentedSo for the changes in the following comments.
#1 (I suggest skipping it) It only puts- " For example," on a new line .. very minor change - also inconsistent with other examples of inline "For example" elsewhere in file.
#2 in patch - NB. setDefault() has been removed. regarding isLocked() - I agree - skip it for now.
#3 in patch
Comment #5
yesct commented#1 appeared to put For example on it's own, line, but really that was because adding Interface to the namespace made the line longer than 80 chars.
Let's still do this.
---
yeah, #2 [#9145521]
---
thought #2339435: Default no longer needs to be a property on Language or ConfigurableLanguage might effect things here. but maybe not.
Comment #6
yesct commentedopened #2340571: LanguageInterface needs isLocked method for the locked property.
Comment #7
yesct commentedto see if caught all similar things, I did a grep/ag:
ag --literal "Entity\ConfigurableLanguage" core/*
look at
core/modules/language/src/Form/LanguageFormBase.php
52: /** @var $language \Drupal\language\Entity\ConfigurableLanguage */
updating that one.
while changing that line, rearranged the order of the @var so it works with more IDEs than just phpstorm.
--
I think this is good now.
--
in irc, @alexpott mentioned that the issue to make the ConfigurableLanguage properties protected should be ... #2226533: Changes to the Language class due to the LanguageInterface (followup).
hm.
.. changing the title since we wont make the properties protected in this issue.
Comment #8
gábor hojtsyLooks good.
Comment #9
alexpottThese should point to the actual implementation since this property is for them and nothing to do with the interface methods.
This will conflict with #2339435: Default no longer needs to be a property on Language or ConfigurableLanguage but in theory also should not change for the same reasons as above.
Comment #10
alexpottAdding tag back
Comment #11
yesct commentedThanks.
I see, these are @see on a property on the class.
(note git diff -U10 gives more context lines)
Ah, and #2339435: Default no longer needs to be a property on Language or ConfigurableLanguage leaves in isDefault() ... but takes out the *property* that these are comments on.
Thanks for pointing that out.
Taking out those changes.
Comment #12
penyaskitoDoes not apply anymore.
Comment #13
penyaskitoOops
Comment #14
martin107 commentedReroll. - No conflicts just auto merging.
Comment #15
mon_franco commentedHi there,
I'm at the Amsterdam Sprint and i'm going to review this issue.
Comment #16
gábor hojtsyComment #17
mon_franco commentedI have some doubts about the return
(@return $this)of some functions. So I didn't change this kind of coder errors yet.Comment #18
penyaskito@return $thisis right (see #2158497: [policy, no patch] Use "$this" and "static" in documentation for @return types and https://www.drupal.org/coding-standards/docs#types).So I think this is RTBC. Thanks everyone!
Comment #19
penyaskitoTalked with @YesCT, #17 change is out of scope, so let's leave that behind.
So the RTBC patch is #14.
Comment #20
alexpottIt is the actual implementation that prevents deleting the default language not the interface. I think this part of the change is incorrect.
Comment #21
yesct commentedthanks. sorry for missing that. reading that whole doc block that is clear. I'll make the change.
Comment #22
yesct commentedoops. the order change in the /** @var */ was going away from the one more recognizable by more IDEs. #2305593: [policy] Set a standard for @var inline variable type declarations So left the order like it is in head.
also put back what @alexpott pointed out.
Comment #23
yesct commentedand the interdiff.
and... while looking at the patch again, noticed that
not
\Drupal\language\Entity\ConfigurableLanguageInterface
it is
\Drupal\language\ConfigurableLanguageInterface
doing that next.
Comment #24
yesct commentedupdating issue summary about which patch to look at also.
Comment #25
penyaskitoI didn't knew #2305593: [policy] Set a standard for @var inline variable type declarations, I will keep that one in mind. Looked if I could change the template in phpstorm and didn't find it, but that's another story.
The patch makes perfect sense.
Comment #26
alexpottCommitted d2cbadc and pushed to 8.0.x. Thanks!
Comment #28
gábor hojtsyGood cleanup, thanks!