Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assets Manager hard reference to \Phalcon\Tag, should use DI #12261

Closed
kristoffer-ingemansson opened this issue Sep 28, 2016 · 2 comments
Closed
Labels
bug A bug report status: medium Medium
Milestone

Comments

@kristoffer-ingemansson
Copy link
Contributor

Assets Manager has hard reference to \Phalcon\Tag when generating HTML.
Assets Manager should fetch tag instance from dependency injector instead to allow custom behavior.

class MyTag extends \Phalcon\Tag
{
    public static function stylesheetLink($parameters = null, $local = true)
    {
        die('bar');
    }
}

$di = new \Phalcon\Di\FactoryDefault();
$di->setShared('tag', MyTag::class);

/** @var \Phalcon\Assets\Manager $manager */
$manager = $di->get('assets');
$manager->addCss('test.css');
$manager->outputCss();

Actual

<link rel="stylesheet" type="text/css" href="/test.css" />

Expected

bar

https://github.com/phalcon/cphalcon/blob/v3.0.1/phalcon/assets/manager.zep#L775
https://github.com/phalcon/cphalcon/blob/v3.0.1/phalcon/assets/manager.zep#L811 (same for JavaScript)

Details

  • Phalcon version: 3.0.1
  • PHP Version: 5.5.24
  • Operating System: Windows 7
  • Installation type: xampp
@sergeyklay sergeyklay added this to the 3.1.0 milestone Dec 19, 2016
@Jurigag
Copy link
Contributor

Jurigag commented Feb 1, 2017

If it's 3.1.0 then if service called tag doesn't exist it should still use Tag class in static way.

@sergeyklay sergeyklay modified the milestones: 3.1.0, 3.2.0 Mar 2, 2017
@sergeyklay sergeyklay modified the milestones: 3.2.0, 4.0.0 Jun 18, 2017
@stale stale bot added the stale Stale issue - automatically closed label Apr 16, 2018
@sergeyklay sergeyklay reopened this May 2, 2018
@stale stale bot removed the stale Stale issue - automatically closed label May 2, 2018
@phalcon phalcon deleted a comment from stale bot Dec 22, 2018
@niden
Copy link
Member

niden commented Mar 12, 2019

Implemented

@niden niden closed this as completed Mar 12, 2019
@niden niden added the 4.0 label Jun 21, 2019
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants