function _social_tagging_node_form_defaults_values in Open Social 8.2
Same name and namespace in other branches
- 8.9 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 8 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 8.3 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 8.4 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 8.5 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 8.6 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 8.7 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 8.8 modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 10.3.x modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 10.0.x modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 10.1.x modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
- 10.2.x modules/social_features/social_tagging/social_tagging.module \_social_tagging_node_form_defaults_values()
Helper function to get the current default tagging values of a node.
1 call to _social_tagging_node_form_defaults_values()
- social_tagging_form_node_form_alter in modules/
social_features/ social_tagging/ social_tagging.module - Implements hook_form_FORM_ID_alter().
File
- modules/
social_features/ social_tagging/ social_tagging.module, line 214 - Contains social_tagging.module.
Code
function _social_tagging_node_form_defaults_values(Node $node) {
// Init.
$default_value = [];
// If the node exists, we need to get the default value.
if ($node instanceof Node && $node
->id() !== NULL) {
foreach ($node
->get('social_tagging')
->getValue() as $key => $value) {
if (isset($value['target_id'])) {
$default_value[] = $value['target_id'];
}
}
}
return $default_value;
}