Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Sep 2014 at 08:22 UTC
Updated:
13 Oct 2014 at 06:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
martin107 commentedFor reference here are examples of classes that also extend ConfigEntityInterface and implement isLocked()
\Drupal\Core\Datetime\DateFormatInterface::isLocked()
\Drupal\system\Entity\MenuInterface::isLocked()
Comment #2
Désiré commentedA first version is attached: Both
LanguageInterface,ConfigurableLanguageandLanguagehave the newisLocked()method. Thelockedproperty is changed to protected, all usages are changed toisLocked().Comment #3
yesct commented?? :)
Comment #4
Désiré commentedComment #5
Désiré commentedComment #6
yesct commenteddo we really need to cast it at a bool?
hm.
\Drupal\Core\Datetime\DateFormatInterface::isLocked()
\Drupal\system\Entity\MenuInterface::isLocked()
both do it like that... so ok with me.
---
if green, this might be ok to go. :)
Comment #9
martin107 commentedHi Désiré, thank for advancing this ....
Looking at the test failure ConfigTranslationUITest, it is a big list but at the very bottom
from LanguageAccessControlHandler line 29
Cannot access protected property Drupal\language\Entity\ConfigurableLanguage::$locked
here is the line
The $entity in this case is a ConfigurableLanguage type and as such $entity->locked needs conversion.
I hope this helps..
Comment #10
Désiré commentedisLocked()call. But I think here we need to do some type check, since thecheckAccess()method expects anEntityInterfacewhich have noisLocked().\Drupal\config_translation\Access\ConfigTranslationOverviewAccess::accesschecks if\Drupal\Core\Language\LanguageManagerInterface::getLanguagedon't returned NULL.Comment #11
Désiré commentedComment #13
Désiré commentedComment #14
Désiré commentedPatch rerolled from #10.
Comment #15
yesct commentedlooking at the interdiff in #10,
yeah, I think a type hint or something is a good idea.
Comment #17
martin107 commentedTypehint is a common pattern ...
\Drupal\filter\FilterFormatAccessControlHandler.
/** @var \Drupal\filter\FilterFormatInterface $filter_format */
\Drupal\comment\CommentAccessControlHandler
/** @var \Drupal\Core\Entity\EntityInterface|\Drupal\user\EntityOwnerInterface $entity */
\Drupal\block\BlockAccessControlHandler
/** @var $entity \Drupal\block\BlockInterface */
but not consistently implemented, for another issue BlockAccessControlHandler is wrong!!
may I suggest the rarely implemented but most correct form :-
\Drupal\comment\CommentAccessControlHandler
/** @var \Drupal\Core\Entity\EntityInterface|\Drupal\user\EntityOwnerInterface $entity */
Comment #18
martin107 commentedPlease forgive me I seem to be the source of mis-information
regarding
/** @var $variableName TYPE **/
or
/** @var TYPE $variableName **
please take #17 with a pinch of salt ( hangs head in shame )
also there is no mention of inline @var in drupal's coding standard. I think I heard some comment somewhere about it being not widely accepted.
Comment #19
Désiré commented\Drupal\language\LanguageAccessControlHandler::checkAccess\Drupal\config_translation\Access\ConfigTranslationOverviewAccess::accesscan grant access if there is no source languageComment #20
Désiré commentedComment #21
martin107 commentedI have visually looked over the patch, everything looks good.
RTBC++
All changes appropriate, nothing out of scope.....
regarding the
/** @var $variableName TYPE **/
or
/** @var TYPE $variableName **/
thing I found a link to the issue POSTPONED says it all...
Comment #22
mon_franco commentedI have reviewed next on this patch:
- Property protected
- ConfigurableLanguage class included
- All places where isLocked should be apply are correct
- Interface isLocked is added too.
Comment #23
alexpottCommitted 2763695 and pushed to 8.0.x. Thanks!