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

Added styling attributes for all components. class, id and style. #34

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Rojoss
Copy link
Contributor

@Rojoss Rojoss commented Feb 19, 2016

I've made it so you can add classes, set the id or set custom css for all attributes.
There is a new config option that must be toggled on for the styling to working.
If styling is disabled it won't be rendered and it will fail to check attributes as the tag would be invalid.

All components now have the more advanced pattern like <tag.*?>(?=.*?</tag>)
For basic components that don't override the render you have to add placeholders in the template.
For example: <div class="bs-wrap bs-wrap-lead lead %s" id="%s" style="%s">

Other components manually have to add the styling tags using the following code:

$style = $this->getStylingAttributes($attributes);

 $markup = sprintf('<%s class="bs-wrap bs-wrap-label label label-%s %s" id="%s" style="%s">',
     $label_tag, $type, $style['class'], $style['id'], $style['style']);

Another example:

//Use the ID from the component instead of styling for components that require a ID
//Because styling might be disabled and you'd still need the id
$markup = sprintf('<div class="bs-wrap bs-wrap-accordion panel-group %s" id="%s" style="%s">',
    $style['class'], $id, $style['style']);

Preview

You can see and test it on my wiki
http://gameboxx.info/wiki/styling?purge=true

@Rojoss
Copy link
Contributor Author

Rojoss commented Feb 19, 2016

#33

@Rojoss Rojoss mentioned this pull request Feb 19, 2016
@giterlizzi
Copy link
Owner

Hi Jos!
! I'm very happy of your implementation. I have created a new local branch to test this new feature.

Best regards,
Joseph

@Rojoss
Copy link
Contributor Author

Rojoss commented Feb 21, 2016

Alright :)
I've tested most of the components and they all work fine for me.

@robertrosman
Copy link

Looks great, I hope it'll get into the main repo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants