Add optional callback to modify the layout attributes and add support for a custom layout attributes class