Needs review
Project:
Social Media Links Block and Field
Version:
8.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Dec 2018 at 15:12 UTC
Updated:
5 Apr 2026 at 18:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amrutalolage commentedComment #3
amrutalolage commentedPatch applied cleanly.
Tested, working fine.
Comment #4
amrutalolage commentedComment #5
kirkkalaGood addition but the first patch did not make the services translatable using the string type. Attached a patch + interdiff to make all links translatable.
Translation of sequence is though slightly difficult and problematic and the attached patch only translates the link urls value and descriptions in the order of sequence, not the actual order..
Comment #6
vacho commentedThis patch solving some problems with drush config:inspect
Comment #7
andypost#6 please provide interdiff
Needs work because "examples" are not a part of schema https://git.drupalcode.org/project/social_media_links/blob/8.x-2.x/src/P...
Comment #8
vacho commentedAbout the patch #5
I review and :
string: Human readable string that must be plain text and editable with a text field.
text: Human readable string that can contain multiple lines of text or HTML
At this documentation: https://www.drupal.org/docs/8/api/configuration-api/configuration-schema...
So patch 5 contemplate links into this fields and it seems well.
About the patch #6
I found some error about the types of fields so it does not solve really the problems with drush config:inspect
It is strange to me because 5 days ago I was sure that it works. but in really patch #1 and patch#5 works well and solve problems with drush config:inspect.
About the comment #7
I found that drush config:inspect need it to validate. The code shows that this is unset but it is on submit not on the build. Please explain a bit more the fault.
Removing examples from schema:
/var/www/html $ drush config:inspect --detail page_manager.page_variant.panels_everywhere
---------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------
Key Status
---------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------
page_manager.page_variant.panels_everywhere:variant_settings.blocks.fdc00696-a290-4810-9e39-8666dfc79467.iconset.installed_iconsets.fontawesome.examples missing schema
---------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------
Comment #9
oleksiyThe last submitted patch (#6) fixes the missed schema for me. Thanks!
Comment #10
neslee canil pinto#2898680: Missing config schema for field, widget and formatter
Comment #11
piggito commented@neslee-canil-pinto this isn't a duplicate cause the issue you referenced is only for field, formatter and widget while this one is for block settings.
Comment #12
vacho commentedAdding a suggestion key for appearance
Comment #13
andypostBoth issues affect the same file, but let's get them both in
Comment #14
colin.eininger commentedHello,
I'm attaching a patch that adds translation capability to the block's schema. I thinks its important to let the user translates at least links and descriptions.
This adds a new data type to use the platform's name as label in the translation form (otherwise every platforms sections are called "Platform settings").
Please review these changes.
Comment #15
andypostNot sure why you need typed data classes.
Just replace all
stringwithtextand that's it.I see no reason to complicate it further
Comment #16
colin.eininger commentedI could replace string with label but every section would be called "Platform settings" which is really hard for an administrator to manage.
Here's a screenshot with label only :
And with the data type :
If there is an easier solution to this problem let me know !
Comment #17
sweetchuck1. When you create a new schema (or a complex data type) then its machine-name has to contain the machine-name of the module, to avoid name collision.
So the "platforms" should be "social_media_links.platform" or something like this.
2. I think there is an other solution to build a complex data without a custom PHP class.
Definition of the image_size.
Usage of the image_size
Comment #18
colin.eininger commented1. I renamed the complex data type by "social_media_links.platform"
2. My first idea was to create a custom complexe type like the image_size :
Then defining each platform like that :
And finally using it :
With that solution :
Pros
Cons
With the php class :
Pros
Cons
I made the choice of a new PHP class to avoid further steps when adding/editing platforms. If that is not a problem but the php class is, we could use the image_size approach. The purpose being that the title of the section is clear.
Comment #19
guilhermevp commentedI liked the solution with complex php class better, I believe is more straightforward for this module in particular, and since the platform class are simple, they are easy to manage as it is. Moving #18 to needs review as more people can vouch in. Also, the classes need to change names as #17 stated?
Comment #20
sweetchuckThe supported platforms are hard-coded anyways.
Keep in mind that there are tools that may use the configuration schema for static analysis of configuration files, like the string extractor for the localization system. Such systems won't work with dynamically defined configuration schemas.
Comment #21
colin.eininger commented#20 you're right but the platform's name is defined as translatable in the plugin definition and should be targeted by the string extractor of the localization system. Then we're using the untranslated platform's name in the dynamically defined configuration and it should be translated (if I understood correctly this system).
Comment #22
dpacassiUsing #18 which fixed the "missing schema" errors.
Comment #23
phma commentedI've been using #18 for a while, but now I'm getting an error trying to import the config.
Comment #25
phma commentedI've opened a merge request with a small change to prevent
hook_config_schema_info_alterfrom ever trying to add a new schema definition, which by design throws an Exception. As to why thesocial_media_links.platformsdefinition wasn't available in the first place, I don't know. All I did was sync the database from production and do adrush cim.Comment #26
gquisini commentedI'll review this one
Comment #27
gquisini commentedI was trying to better understand what the role of the schema file is. According to doc, there are a few uses for the schema and the primary use case is for multiple language support. In an attempt to find something to validate, I installed the config_inspector module and it was shown as if everything was correct. I will attach some screenshots to comparison.
Sorry if my contribution was not very helpful, I will study a little more to better understand the use of the schema file.
Comment #29
lucasscI rebased the issue fork to prepare it to be merged into 8.x-2.x.
Comment #30
sophiavs commentedI'll review :)
Comment #31
sophiavs commentedI tested the functionalities of the module with the last commit and everything worked fine. I didn't saw any wrong schema. Passing to RTBC
Comment #33
tobiasbfyi: The weight should be a integer and show_name a boolean. I fixes this already in the fork.
Comment #34
japerryWith #2898680: Missing config schema for field, widget and formatter committed, this likely needs a reroll. Also, would like to see some tests similar to the other issue before it gets committed.
Comment #35
ilya.no commentedI've been using patch, made from the MR, via https://git.drupalcode.org/project/social_media_links/-/merge_requests/1..., but after upgrading to D10.3.2 I've got error, as described in https://www.drupal.org/project/social_media_links/issues/3461790.
I haven't traced the issue, but it seems to be related to the solution with src/Plugin/Config/Schema/Platforms.php, because when I removed corresponding changes and added code from #12 patch, then the issue was gone.
I'm attaching a bit updated patch with several fixes in order to have ability for deploy.
I think, that issue's priority should be set to Critical, because currently it's not possible to import configuration.
In order to reproduce, need to create page manager variant and add "Social Media Links" block.
Comment #36
colin.eininger commentedI have created new drupal 10.2 and 10.3 instances, installed social_media_links module with the patch from MR!12. Added a block and exported the configuration. Then removed the block and imported the configuration.
Everything works as expected.
In order to troubleshoot your problem @ilya.no, can you describe all minimal step to reproduce ? In the other issue you said "Need to create page manager page". Is that the layout builder your refering to ?
Comment #37
colin.eininger commentedOk, I wasn't on 10.3 during my tests. Tried again and reproducing the error. I'm looking at the issue rn.
Comment #40
colin.eininger commentedI fixed the error on drupal 10.3.
When drupal retrieve a map key, it try to guess which type its parent's definition is and expect it to be either a MapDataDefinition or a SequenceDataDefinition.
We were using the ListDataDefinition which is unexpected. I switched our social_media_links.platforms type to use SequenceDataDefinition (which inherit from ListDataDefinition).
I tested the patch on drupal 10.2 and 10.3.
Comment #41
codebymikey commentedAttached static copy of the current MR.
Comment #42
codebymikey commentedComment #43
wim leersFYI, this is also causing a fatal error in #3578295: social_media_links' broken block plugin causes fatal error: unexpected error has occurred while fetching components.
Another bug is the absence of a correct
::defaultConfiguration()method — right now the default configuration is the fallback value[], which will trigger a PHP error for this block plugin'sbuild()method.Comment #44
wim leersNW for the other bug mentioned in #43.
Comment #45
tobiasbI added the missing default configuration, improved the config schema and some basic tests.