Skip to content
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

intl is not passed to the initialValue function #6529

Open
wesleybl opened this issue Dec 11, 2024 · 6 comments · May be fixed by #6538
Open

intl is not passed to the initialValue function #6529

wesleybl opened this issue Dec 11, 2024 · 6 comments · May be fixed by #6538
Assignees

Comments

@wesleybl
Copy link
Member

Describe the bug
The documentation says that initialValue recives the variable intl. See:

https://github.com/plone/volto/blob/03b30f9817d0883f27b82bf789f6a6225b1aaec3/docs/source/blocks/settings.md#initialvalue

But when printing the intl variable inside the initialValue function, it received an undefined.

To Reproduce
Steps to reproduce the behavior:

  1. Create a block with the initialValue setting. For example:
function initialValue({ id, value, formData, intl }) {
  console.log(intl);
  return {
    ...formData.blocks[id],
  };
}
const applyConfig = (config) => {
  config.blocks.blocksConfig.myBlock = {
    id: 'myBlock',
    initialValue: initialValue,
    ...
  };
  return config;
};
  1. Add the block to a page
  2. See that the console displays undefined.

Expected behavior
The int variable must have the internationalization object.

Software (please complete the following information):

OS: Ubuntu
Volto 18.2.3
Plone 6.0.13
plone.restapi 9.7.2
CMF 3.5
Zope 5.10
Python 3.11.9 (main, Sep 4 2024, 23:13:27) [GCC 10.2.1 20210110]
PIL 9.5.0 (Pillow)

Additional context
Note that initialValue does not actually receive intl:

value = blocksConfig[type].initialValue({
id,
value,
formData,
});

@Ratangulati
Copy link

Hey, @wesleybl Can I work on this issue?

@stevepiercy
Copy link
Collaborator

@Ratangulati please read and follow First-time contributors, especially Things not to do, Contributing to Plone, and Contributing to Volto.

@wesleybl
Copy link
Member Author

Hey, @wesleybl Can I work on this issue?

Hi @Ratangulati! I'm already working on it. Thanks for your interest!

@stevepiercy
Copy link
Collaborator

@wesleybl do you have permission to self-assign issues in this repo? If not, I can grant you that permission. I just assigned you to this one, since you claimed it. Please let me know. Thank you!

@wesleybl
Copy link
Member Author

@wesleybl do you have permission to self-assign issues in this repo? If not, I can grant you that permission. I just assigned you to this one, since you claimed it. Please let me know. Thank you!

@stevepiercy Yes I have permission. Sorry for not doing this sooner. I will make a PR soon.

@Ratangulati
Copy link

Hey, @wesleybl Can I work on this issue?

Hi @Ratangulati! I'm already working on it. Thanks for your interest!

Okay 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants