function RealisticDummyContentEntityBase::filter in Realistic Dummy Content 7
Check if a field should or shouldn't be manipulated.
This concept is used especially because of a quirk in the user insertion hooks: hook_user_insert() can't modify the user picture whereas hook_user_presave() can modify only the picture.
To get around this, the manipulator objects are called twice, but each time filtered to change only certain parts of the user entity.
2 calls to RealisticDummyContentEntityBase::filter()
- RealisticDummyContentFieldModifier::GetFields in api/
includes/ RealisticDummyContentEntityFieldModifier.inc - Get fields for the entity, for example body or field_image.
- RealisticDummyContentFieldModifier::GetProperties in api/
includes/ RealisticDummyContentEntityFieldModifier.inc - Get properties for the entity, for example user's picture or node's name.
File
- api/
includes/ RealisticDummyContentEntityBase.inc, line 142 - Define RealisticDummyContentEntityBase autoload class.
Class
- RealisticDummyContentEntityBase
- Generic entity manipulator.
Code
function filter($field) {
$return = TRUE;
$filter = $this
->GetFilter();
if (isset($filter['include'])) {
if (!in_array($field, $filter['include'])) {
$return = FALSE;
}
}
elseif (isset($filter['exclude'])) {
if (in_array($field, $filter['exclude'])) {
$return = FALSE;
}
}
return $return;
}