-
Notifications
You must be signed in to change notification settings - Fork 106
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 a lot of documentation on Callbacks, VirtualPages and other topics #200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good documentation. Now i understand callbacks and virtual page better.
Still there are few places where i would love to have just 1-2 sentences more with explanation what user will see on screen when trying examples provided above.
docs/callbacks.rst
Outdated
component. | ||
|
||
One example of this behaviour is the format of :php:meth:`View::on` where you pass 2nd argument as a | ||
PHP callback:: | ||
|
||
$button = new Buttion(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button
docs/callbacks.rst
Outdated
browser with a special GET argument a certain code can be triggered inside the on() method that short-circuts | ||
output producing response specifically for button. | ||
Adding Callback into any object will not affect the rendering, but it will make Callback part of the | ||
:ref:`render_tree` and it will produce it with a unique callback URL: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't understand this part of sentence:
it will produce it with a unique callback URL
docs/callbacks.rst
Outdated
$label = $layout->add(['Label','Callback URL:']); | ||
$cb = $label->add('Callback'); | ||
$label->detail = $cb->getURL(); | ||
$label->link($cb->getURL()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe one more sentence about what we will see on screen and what can we do with it.
docs/callbacks.rst
Outdated
|
||
.. php::class: Callback | ||
if($cb->set(function(){ return true; })) { | ||
$label->addClass('red'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more sentence about what will happen in this case.
docs/callbacks.rst
Outdated
|
||
.. php::method: getURL() | ||
$cb->set(function(){ echo 123; }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above - 1 sentence about what will happen on screen
docs/callbacks.rst
Outdated
|
||
.. php:method: set(callback, arguments) | ||
If you have passed argument to getURL() the value of this argument will be also asigned to $triggered property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example?
docs/callbacks.rst
Outdated
$label = $layout->add(['Label','Callback URL:']); | ||
$cb = $label->add('jsCallback'); | ||
|
||
$cb->set(function() use($app) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to use($app) here
Although VirtualPage works without defining a callback, using one is more reliable and is always recommended:: | ||
|
||
$vp = $layout->add('VirtualPage'); | ||
$vp->set(function($vp){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 sentence about what we will see on screen and why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good in general.
As Imants say, it is difficult to understand, for a new atk user, what certain part of code is doing. Perhaps adding comment on code line, telling reader what this part of code does in final page rendering would help.
May be also adding a diagram, like sequence or flow diagram for example, would help better understand the concept of Callback.
But generally good documentation. It did help me a lot to understand Callback.
Just a LOT of documentation