Skip to content

[Templating] Allow asset() function to work with absolute paths too #12474

@hason

Description

@hason

I want to support add a version for an absolute path. The current implementation skips the absolute paths https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Templating/Asset/PathPackage.php#L50. For example, the imagine_filter twig filter generates the absolute paths. I wan to do:

{{ article.image|imagine_filter('thumb') }}
{# http://my_project/media/cache/thumb/my_image.jpg #}

{{ asset(article.image|imagine_filter('thumb')) }}
{# http://my_project/media/cache/thumb/my_image.jpg?12 #}

Maybe it should add a new parameter $force:

namespace Symfony\Component\Templating\Asset;

interface PackageInterface
{
    public function getUrl($path, $version = null, $force = false);
}

Fixes liip/LiipImagineBundle#507

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions