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

Allow modules to alter the default field storage value through a hook. #38

Merged
merged 1 commit into from
Mar 23, 2016

Conversation

svendecabooter
Copy link
Contributor

No description provided.

@@ -279,7 +279,14 @@ protected function processValue(ContentEntityInterface $entity, FieldItemListInt
// Return value to store for unencrypted property.
// We can't set this to NULL, because then the field values are not saved,
// so we can't replace them with their unencrypted value on load.
return '[ENCRYPTED]';
$unencrypted_storage_value = '[ENCRYPTED]';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about numeric values?

@nerdstein
Copy link
Contributor

This looks great as well, thanks. Left one small comment. Maybe we have default values by field type, e.g. a date, a string, a number...

@nerdstein
Copy link
Contributor

Please feel free to merge and/or make separate issues where relevant

@svendecabooter
Copy link
Contributor Author

Settings default values for some less obvious field types could be considered, but we have to be careful of not skewing the actual data. For example you'd have to pick a date that hopefully can't be confused with real date values.

I'd have to think about whether it would be better to explicitly force site builders to consider this scenario (by having to implement the hook, and hopefully understanding the consequences), versus doing that for them...

@nerdstein
Copy link
Contributor

Do you want to merge this in for now and explore this use case further in another issue?

@svendecabooter
Copy link
Contributor Author

Yeah sounds good.

@nerdstein nerdstein merged commit 539f2f0 into d8-contrib-modules:master Mar 23, 2016
@nerdstein
Copy link
Contributor

Merged - please create the issue so we can track it

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

Successfully merging this pull request may close these issues.

None yet

2 participants