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

[Question] Can a plugin override core functions? #1957

Closed
rica-carv opened this issue Oct 25, 2016 · 8 comments
Closed

[Question] Can a plugin override core functions? #1957

rica-carv opened this issue Oct 25, 2016 · 8 comments
Labels
type: question An ask about behavior that is not found documented anywhere

Comments

@rica-carv
Copy link
Contributor

For instance, is it possible to alter the function toGlyph at a plugin basis?
Let's say i want to use another icon fonts besides Glyphicons or Fontawesome globally, even with another tag output instead the only two alowed (span & i).
e107::getParser()->toGlyph('fa-user-times','fw=1')
Therefore i would need to redefine this core function at plugin (or module) basis.

Is it possible to do it?

@lonalore
Copy link
Member

I think it is possible. Check e_parse.php addon files.

@lonalore
Copy link
Member

No... I was wrong. It can be used only for extending toHtml() functionality.

@rica-carv
Copy link
Contributor Author

@lonalore Maybe i've expressed myself wrong. I'm thinking of globally override a core function, to replace the original sitewide, not only in the plugin....

@Moc Moc added the type: question An ask about behavior that is not found documented anywhere label Oct 26, 2016
@Moc
Copy link
Member

Moc commented Oct 26, 2016

Yes and no. There is is no generic function to override core methods but there are many things implemented which allow for a huge amount of customization. There are addons (such as e_html, e_user, e_...) and also shortcodes provide plenty opportunities for customization. Each case is different, it would therefore be better to specify exactly what you'd like to change or do so we can give more specific advice. Sometimes there are already options available and no editing (or overriding) of core methods is required.

As for changing the toGlyph method, I don't think this is possible. What kind of icons do you have in mind? In general, such type of code (icons) use either the <span> or <i> tag.

EDIT: are you referring to SVG icons as discussed in #1958 ?

@rica-carv
Copy link
Contributor Author

@Moc My ideia is to use the <svg> tag....
And yes, this question is somehow directly related to #1958...
But it can also be of some use for somebody to change any core class function....

@Moc
Copy link
Member

Moc commented Oct 26, 2016

Alright, then my answer above still stands :) I've updated it slightly.

Regarding the SVG icons, we'll continue that discussion in the other issue.
Closing this one.

@Moc Moc closed this as completed Oct 26, 2016
@rica-carv
Copy link
Contributor Author

rica-carv commented Oct 26, 2016

Maybe another workaround for the toGlyph would be to template the toGlyph hardcoded html....
Just a thought....

@Moc
Copy link
Member

Moc commented Oct 26, 2016

Put that in the other issue haha 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question An ask about behavior that is not found documented anywhere
Projects
None yet
Development

No branches or pull requests

3 participants