本文整理汇总了PHP中Nette\Application\UI\Control::getSnippetId方法的典型用法代码示例。如果您正苦于以下问题:PHP Control::getSnippetId方法的具体用法?PHP Control::getSnippetId怎么用?PHP Control::getSnippetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Control
的用法示例。
在下文中一共展示了Control::getSnippetId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSnippet
public function addSnippet($name, $content)
{
if ($this->payload === NULL) {
$this->payload = $this->control->getPresenter()->getPayload();
}
$this->payload->snippets[$this->control->getSnippetId($name)] = $content;
}
示例2: renderSnippets
public static function renderSnippets(UI\Control $control, \stdClass $local, array $params)
{
$control->snippetMode = FALSE;
$payload = $control->getPresenter()->getPayload();
if (isset($local->blocks)) {
foreach ($local->blocks as $name => $function) {
if ($name[0] !== '_' || !$control->isControlInvalid((string) substr($name, 1))) {
continue;
}
ob_start(function () {
});
$function = reset($function);
$snippets = $function($local, $params + array('_snippetMode' => TRUE));
$payload->snippets[$id = $control->getSnippetId((string) substr($name, 1))] = ob_get_clean();
if ($snippets !== NULL) {
// pass FALSE from snippetArea
if ($snippets) {
$payload->snippets += $snippets;
}
unset($payload->snippets[$id]);
}
}
}
$control->snippetMode = TRUE;
if ($control instanceof UI\IRenderable) {
$queue = array($control);
do {
foreach (array_shift($queue)->getComponents() as $child) {
if ($child instanceof UI\IRenderable) {
if ($child->isControlInvalid()) {
$child->snippetMode = TRUE;
$child->render();
$child->snippetMode = FALSE;
}
} elseif ($child instanceof Nette\ComponentModel\IContainer) {
$queue[] = $child;
}
}
} while ($queue);
}
}
示例3: getSnippetId
public function getSnippetId($name = NULL)
{
return $this->control->getSnippetId($name);
}
示例4: renderSnippets
public static function renderSnippets(Nette\Application\UI\Control $control, \stdClass $local, array $params)
{
$control->snippetMode = false;
$payload = $control->getPresenter()->getPayload();
if (isset($local->blocks)) {
foreach ($local->blocks as $name => $function) {
if ($name[0] !== '_' || !$control->isControlInvalid(substr($name, 1))) {
continue;
}
ob_start();
$function = reset($function);
$snippets = $function($local, $params);
$payload->snippets[$id = $control->getSnippetId(substr($name, 1))] = ob_get_clean();
if ($snippets) {
$payload->snippets += $snippets;
unset($payload->snippets[$id]);
}
}
}
$control->snippetMode = true;
if ($control instanceof Nette\Application\UI\IRenderable) {
$queue = array($control);
do {
foreach (array_shift($queue)->getComponents() as $child) {
if ($child instanceof Nette\Application\UI\IRenderable) {
if ($child->isControlInvalid()) {
$child->snippetMode = true;
$child->render();
$child->snippetMode = false;
}
} elseif ($child instanceof Nette\ComponentModel\IContainer) {
$queue[] = $child;
}
}
} while ($queue);
}
}
示例5: getSnippetId
public function getSnippetId($name = NULL) : string
{
$uniqueId = $this->getUniqueId();
return str_replace($uniqueId, implode('-', [$uniqueId, isset($this->views[$name]) ? $name : $this->view]), parent::getSnippetId(isset($this->views[$name]) ? NULL : $name));
}
示例6:
Nette\InvalidStateException("Cannot include undefined parent block '$name'.");}$block($context,$params);}static
function
renderSnippets(Nette\Application\UI\Control$control,\stdClass$local,array$params){$control->snippetMode=FALSE;$payload=$control->getPresenter()->getPayload();if(isset($local->blocks)){foreach($local->blocks
as$name=>$function){if($name[0]!=='_'||!$control->isControlInvalid(substr($name,1))){continue;}ob_start();$function=reset($function);$snippets=$function($local,$params);$payload->snippets[$id=$control->getSnippetId(substr($name,1))]=ob_get_clean();if($snippets){$payload->snippets+=$snippets;unset($payload->snippets[$id]);}}}if($control
instanceof
Nette\Application\UI\IRenderable){$queue=array($control);do{foreach(array_shift($queue)->getComponents()as$child){if($child
instanceof
Nette\Application\UI\IRenderable){if($child->isControlInvalid()){$child->snippetMode=TRUE;$child->render();$child->snippetMode=FALSE;}}elseif($child
instanceof
Nette\ComponentModel\IContainer){$queue[]=$child;}}}while($queue);}}}}namespace Nette\Utils{use
示例7: getSnippetId
/**
* Custom snippet format
*/
public function getSnippetId($name = NULL)
{
if ($this->snippetGenerator === NULL) {
return parent::getSnippetId($name);
}
return $this->snippetGenerator->getSnippetId($this, $name);
}