-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
TwigExtension - detect (in)human agent #1209
Conversation
This reverts commit f656330.
Incorrect comment updated.
Add function ishuman() to detect agent disposition.
The change in system/src/Grav/Common/Taxonomy.php is not related I think? Also, please update your branch as it seems there are some conflicts with the current develop. |
# Conflicts: # system/src/Grav/Common/Taxonomy.php # system/src/Grav/Common/Twig/TwigExtension.php
Taxonomy is unrelated, don't know why it shows up here. I tried to update the branch, which appears to have resolved the conflicts. |
Hmm. you appear to have pushed files with merge conflicts. Take a look at the "Files changed" tab. |
…velop"" This reverts commit 50fc775.
Seems to be ok now. I will take another hard look at my workflow. |
Usage: {% if ishuman() %}
human
{% else %}
not human
{% endif %} Avoid instantiating Browser as it's already added to the Grav object: public function isHuman()
{
return $this->grav['browser']->isHuman();
} But, since the same functionality can be achieved using {% if browser.ishuman %}
human
{% else %}
not human
{% endif %} I'm a bit unsure if it's worth this shortcut. |
Sounds reasonable to me. Frankly, I didn't realize it could be solved this way. Since this is functionally equivalent and trivial to code, I'll take no for an answer. |
Yah I think that using I've added this line item to: getgrav/grav-learn#356 |
Added function ishuman() to TwigExtension.