Input/output filters to store/restore paths using either stream wrapper notation or a managed file ID token. This module does two things:
- when content is saved, it will store URLs in text fields in a portable fashion.
- when content is rendered, the input filter will replace the stream wrapper URL or file ID token with a relative URL.
This can be easily used with the Insert module which inserts an absolute or relative URL. On save of the content, this module will replace the URL with a path using stream wrapper notation or a file ID token.
The motivation behind this is to store URLs in text fields (e.g. node body) in a portable fashion so that a database can be ported across environments and domains. For example, if the environment consists of development, stage, and production URLs like:
with files stored in the public files directory which may be named the same as the domain like:
This would be a typical setup using a provisioning system like Aegir which, during site creation, allows for specification of the domain name but not the directory name.
This module will also enable the content to be portable during a domain name change such as from example.com to rename.com.
After a review of existing input filters and related modules, none seemed to do this. Some remove the domain portion of the path, making the path portable in certain contexts but not across all use cases. But none finished the job by replacing the file structure path. If someone is aware of a module doing what this does, let me know.