本文整理匯總了PHP中HTML_QuickForm2_Renderer::setJavascriptBuilder方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTML_QuickForm2_Renderer::setJavascriptBuilder方法的具體用法?PHP HTML_QuickForm2_Renderer::setJavascriptBuilder怎麽用?PHP HTML_QuickForm2_Renderer::setJavascriptBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HTML_QuickForm2_Renderer
的用法示例。
在下文中一共展示了HTML_QuickForm2_Renderer::setJavascriptBuilder方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setJavascriptBuilder
public function setJavascriptBuilder(HTML_QuickForm2_JavascriptBuilder $builder = null)
{
$this->_renderer->setJavascriptBuilder($builder);
return $this;
}
示例2: render
/**
* Renders the container using the given renderer
*
* Container will be output N + 1 times, where N are visible items and 1 is
* the hidden prototype used by Javascript code to create new items.
*
* @param HTML_QuickForm2_Renderer $renderer renderer to use
*
* @return HTML_QuickForm2_Renderer
*/
public function render(HTML_QuickForm2_Renderer $renderer)
{
$backup = $this->backupChildAttributes(true, true);
$hiddens = $renderer->getOption('group_hiddens');
$jsBuilder = $renderer->getJavascriptBuilder();
$evalBuilder = new HTML_QuickForm2_Container_Repeat_JavascriptBuilder();
$renderer->setJavascriptBuilder($evalBuilder)->setOption('group_hiddens', false)->startContainer($this);
// first, render a (hidden) prototype
$this->getPrototype()->addClass('repeatItem repeatPrototype');
$this->getPrototype()->render($renderer);
$this->getPrototype()->removeClass('repeatPrototype');
// restore original JS builder
$evalBuilder->passLibraries($jsBuilder);
$renderer->setJavascriptBuilder($jsBuilder);
// next, render all available rows
foreach ($this->getIndexes() as $index) {
$this->replaceIndexTemplates($index, $backup);
/* @var HTML_QuickForm2_Node $child */
foreach ($this->getRecursiveIterator() as $child) {
if (isset($this->childErrors[$hash = spl_object_hash($child)]) && isset($this->childErrors[$hash][$index])) {
$child->setError($this->childErrors[$hash][$index]);
}
}
$this->getPrototype()->render($renderer);
}
$this->restoreChildAttributes($backup);
// only add javascript if not frozen
if (!$this->toggleFrozen()) {
$jsBuilder->addLibrary('repeat', 'quickform-repeat.js');
$jsBuilder->addElementJavascript($this->_generateInitScript($evalBuilder));
$this->renderClientRules($jsBuilder);
}
$renderer->finishContainer($this);
$renderer->setOption('group_hiddens', $hiddens);
return $renderer;
}