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

Aliasing of attributes missing #31

Closed
sckoop opened this issue Dec 5, 2012 · 6 comments
Closed

Aliasing of attributes missing #31

sckoop opened this issue Dec 5, 2012 · 6 comments

Comments

@sckoop
Copy link
Contributor

sckoop commented Dec 5, 2012

Hi Miles,

I've got one question. In the newest version of decoda. I miss the possibility to alias a attribute. Is there a specific reason why it is removed?

Kind regards
Sean

@milesj
Copy link
Owner

milesj commented Dec 5, 2012

All of the field names changed, check out FilterAbstract to see what they should be.

@milesj milesj closed this as completed Dec 5, 2012
@sckoop
Copy link
Contributor Author

sckoop commented Dec 5, 2012

Hi Miles,

checked it and think it was map attributes which seems not be working correctly.

For example you've got the following configuration for a url tag.

...
'attributes' => array(
    'target' => '/self|new/i'
 ),
'mapAttributes' => array(
    't' => 'target'
),
...

and the string looks as following:
[url t="new"][/url]
In the old style you could use the alias parameter and it the parser handled it like the target attribute. Now I would need to add the t value as well to the attributes to have this correctly handled. (Which make it obsolete to define it in the mapping)

Reason is that in line 1016 in decoda.php only the source is checked for the key without consideration of the mapping. Do you see it as possible to bring back this behaviour?

@milesj
Copy link
Owner

milesj commented Dec 5, 2012

I think the problem is that this line should be $finalKey instead of $key. The code is pretty much the same thing as it was before.

https://github.com/milesj/php-decoda/blob/master/Decoda.php#L1016

@sckoop
Copy link
Contributor Author

sckoop commented Dec 6, 2012

Tried it but then you get a problem with the url tag and the mapping of default to href.
I thought about it to check in https://github.com/milesj/php-decoda/blob/master/Decoda.php#L1016 both attributes, but then you've got still the problem that the pattern is not correctly loaded.

@milesj
Copy link
Owner

milesj commented Dec 7, 2012

Ok, check out the latest master commit. This should fix it.

It still uses mapAttributes.

@sckoop
Copy link
Contributor Author

sckoop commented Dec 10, 2012

Thanks works fine :)

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

No branches or pull requests

2 participants