ContaoJson tries to pack "everything Contao" into a JSON-serializable package.
It works with:
- Contao Collections
- Contao Models
- Arrays (of Models or anything else)
- Objects
- Strings and numbers The main features are
- File objects (e.g. singleSRC) are resolved automatically
- Serialized arrays are resolved automatically
- HTML will be unescaped automatically
- Contao Insert-Tags are resolved automatically ContaoJson will recursively call itself until all fields are resolved.
- Class name: ContaoJson
- Namespace: DieSchittigs\ContaoContentApiBundle
- This class implements: JsonSerializable
public mixed $data = null
- Visibility: public
private mixed $allowedFields
- Visibility: private
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::__construct(mixed $data, array $allowedFields)
constructor.
- Visibility: public
- $data mixed - <p>any data you want resolved and serialized</p>
- $allowedFields array - <p>an array of whitelisted keys (non-matching values will be purged)</p>
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::handleCollection(\Contao\Model\Collection $collection)
- Visibility: private
- $collection Contao\Model\Collection
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::handleArray(array $array)
- Visibility: private
- $array array
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::handleObject(\DieSchittigs\ContaoContentApiBundle\object $object)
- Visibility: private
- $object DieSchittigs\ContaoContentApiBundle\object
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::handleNumber($number)
- Visibility: private
- $number mixed
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::handleString(\DieSchittigs\ContaoContentApiBundle\string $string)
- Visibility: private
- $string DieSchittigs\ContaoContentApiBundle\string
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::isAssoc(array $arr)
- Visibility: private
- $arr array
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::unserialize(\DieSchittigs\ContaoContentApiBundle\string $string)
- Visibility: private
- $string DieSchittigs\ContaoContentApiBundle\string
mixed DieSchittigs\ContaoContentApiBundle\ContaoJson::jsonSerialize()
- Visibility: public