-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UHF-8926 #460
Conversation
…et to be same as node tranlation status
…roup menu items to match the node status
/** | ||
* Update group menu item's content translation status to match node's status. | ||
*/ | ||
function helfi_group_update_9001() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing return type.
} | ||
|
||
$node = $node->getTranslation($langcode); | ||
if ((bool) $menu_item->content_translation_status->value != (bool) $node->isPublished()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use strict comparison !==
, $node->isPublished() will always return boolean already
} | ||
|
||
/** | ||
* Ticket #UHF-8926: submit handler to set menu items translation status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ticket ID is reduntant here imo, it's already explained in code using this handler.
/** | ||
* Implements hook_form_BASE_FORM_ID_alter(). | ||
* | ||
* #UHF-8926 Prevent group's MenuContentLink's translation form from crashing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment could be explained better. Something like:
Group menu emits menu parent from entity's translation form. Make sure menu_parent is always set.
$values = $form_state->getValue('menu'); | ||
$node = $form_state->getFormObject()->getEntity(); | ||
$langCode = $node->language()->getId(); | ||
if (!empty($values['entity_id'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two ifs can be combined
… in main menu button. use link's translation instead of the default link
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good to go 🦖
UHF-8926
-Prevent white screen while editing group menu item translation
-Node's edit pages "published on main navigation" checkbox now updates based on group's menu content item's content translation status
What was done
Updated group module
Fixed white screen.
Form alter to keep the "content translation status" checkbox on correct state. For group content, the "published in main navigation" state follows the node's published state. Value is updated while saving (not with javascript)
Update hook to update group's menu item's content translation status to match node status.
How to install
git checkout UHF-8926
composer require drupal/helfi_navigation:dev-UHF-8926
make fresh
make drush-cr
How to test
Log in as user which is assigned to a group, for example user 19.
Other PRs: