Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
22 Feb 2024 at 11:45 UTC
Updated:
10 Apr 2025 at 11:01 UTC
Jump to comment: Most recent
Comments
Comment #2
vishal.kadamThank you for applying!
Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.
The important notes are the following.
phpcs --standard=Drupal,DrupalPracticeon the project, which alone fixes most of what reviewers would report.To the reviewers
Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.
The important notes are the following.
For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.
Comment #3
vishal.kadamComment #4
vishal.kadamFix phpcs issues.
Comment #5
guiu.rocafort.ferrerThank you for the review @vishal.kadam.
The phpcs issues have been fixed in the 1.0.x branch.
For some reason the gitlab-ci template does not pick them up.
Ready for review again.
Comment #6
vishal.kadamRest looks fine to me.
Let’s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.
Comment #7
avpadernosrc/Form/SettingsForm.php
There is no need to create a form class for a plugin settings: That is returned by the plugin's
buildConfigurationForm()method.$config = $this->configFactory()->getEditable('social_media_platforms.settings');It is sufficient to call
$this->config(), to get an editable configuration object.src/Plugin/Block/SocialMediaBlock.php
The short description is not for the class it should describe.
Comment #8
guiu.rocafort.ferrerThank you for the review @apaderno.
I have addressed the issues, and the code is ready to review again.
Comment #9
guiu.rocafort.ferrerChanging the issue status to needs review.
Comment #10
rushikesh raval commentedI am changing the issue priority as per issue priorities.
Comment #11
vishal.kadamI am changing priority as per Issue priorities.
Comment #12
avpadernosrc/Form/SettingsForm.php
The form element title is not translatable.
src/Plugin/Block/SocialMediaBlock.php
The configuration form for a plugin does not give a link to page that allows to change the plugin settings. It shows the settings form, which also means the
Drupal\social_media_platforms\Form\SettingsFormclass is not necessary.Comment #13
guiu.rocafort.ferrerHi @avpaderno.
Thank you again for your feedback.
I have addressed the translatable elements issue as requested.
Please notice that i added a @codingStandardsIgnoreLine because phpcs did not seem to understand that the value of the variable is comming from a literal ( defined as a CONST in the class itself ), and complained about "Only string literals should be passed to t() where possible".
Regarding the block configuration, i am aware that this might not be the habitual way of handling it, but it is completely intentional, and part of how the module works. This module defines a block, that uses some settings defined outside the block itself. This is made on purpose to allow the domain_config subdomain to be able to define different variations of it for different domains. The link in the block settings form is merely a reminder for people that might be confused by how the module works, since there is another similar module "Social Media Block and Field" that works placing the configuration in the block itself. Please read the module description and let me know if you have any further questions about this issue.
Comment #14
guiu.rocafort.ferrerChanging issue status to needs review.
Comment #15
avpadernoSocialMediaBlock::buildConfigurationForm()is still not returning a configuration form.Comment #16
guiu.rocafort.ferrerHi @avpaderno,
I am a bit confused about what you are saying. SocialMediaBlock::buildConfigurationForm() is getting the form from the parent, and then adding a link element before returning it. The only reason i could think of this not being a good practice, might be the fact that the function is not adding any form element, it is just adding a link. I could remove the buildConfigurationForm method and add a form_alter in the .module file to add the link instead, would that be a more acceptable practice ?
Comment #17
avpadernoThe following code is not building a form. It is giving a link to a page where a form can be found. That is not building a form.
BlockBasejust build the part of the form that is common for all the plugins, but that is not the full form for a plugin. That is whyViewsBlockBase::buildConfigurationForm()uses the following code.That is the code to build a form for a plugin.
Comment #18
guiu.rocafort.ferrerSo if i remove the buildConfigurationForm method for the class and implement a form_alter hook, would this be considered a better approach for this use case ? @avpaderno
Comment #19
avpadernoNo, that would not be a better approach. The method to implement is
buildConfigurationForm(), which needs to return the form elements, not the build array for a link to a different page containing a form.Comment #20
guiu.rocafort.ferrerHi @avpaderno
The thing is that this is made on purpose, and it is part of how this module work and makes sense. The fact that the configuration is in a separate settings form, allows the submodule from domain (domain_config) to override the settings for different domains. If i would add the configuration form at the block itself, then this module would not have any reason to exist, because the "Social Media Links Block and Field" module ( https://www.drupal.org/project/social_media_links ) would have the same functionality.
If this is not acceptable to grant the security advisory coverage, let me know and we can close the issue, so we don't waste each other's time. I will try to qualify for the security advisory coverage when i have a chance to contribute another Drupal module and open a new issue.
Comment #21
guiu.rocafort.ferrerComment #22
avpadernoIn that case, you do not need to implement
buildConfigurationForm()and using a form class is correct. I should have been explicit and say:Comment #23
avpadernoComment #24
guiu.rocafort.ferrerHi @avpaderno
I have removed the buildConfigurationForm and implemented a form_alter hook instead.
Marking as needs review.
Comment #25
avpadernoIt seems I was not clear: There is no need to implement
hook_form_alter()because there is already a form class that is accessible from a route.hook_form_alter()would not be necessary even in the case the plugin settings form is built from a plugin method.Comment #26
guiu.rocafort.ferrerHi @avpaderno,
I removed the hook_form_alter. Please review.
Thank you for your patience.
Comment #27
avpadernoThank you for your contribution and for your patience with the review process!
I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.
These are some recommended readings to help you with maintainership:
You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank the dedicated reviewers as well.
Comment #28
avpadernoComment #30
avpaderno