当前位置: 首页>>代码示例>>PHP>>正文


PHP ModelInterface::getChildren方法代码示例

本文整理汇总了PHP中Zend\View\Model\ModelInterface::getChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP ModelInterface::getChildren方法的具体用法?PHP ModelInterface::getChildren怎么用?PHP ModelInterface::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\View\Model\ModelInterface的用法示例。


在下文中一共展示了ModelInterface::getChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addChildrenToView

 /**
  * @param ModelInterface $viewModel
  * @param callable $addToViewFromModel
  */
 protected function addChildrenToView(ModelInterface $viewModel, $addToViewFromModel)
 {
     if ($viewModel->hasChildren()) {
         foreach ($viewModel->getChildren() as $child) {
             $addToViewFromModel($child);
             $this->addChildrenToView($child, $addToViewFromModel);
         }
     }
 }
开发者ID:shitikovkirill,项目名称:zend-shop.com,代码行数:13,代码来源:RequestCollector.php

示例2: renderChildren

 /**
  *
  * @param ModelInterface $model
  */
 protected function renderChildren(ModelInterface $model)
 {
     foreach ($model->getChildren() as $child) {
         $result = $this->render($child);
         $capture = $child->captureTo();
         if (!empty($capture)) {
             if ($child->isAppend()) {
                 $oldResult = $model->{$capture};
                 $model->setVariable($capture, $oldResult . $result);
             } else {
                 $model->setVariable($capture, $result);
             }
         }
     }
 }
开发者ID:adamdyson,项目名称:ConLayout,代码行数:19,代码来源:BlockRenderer.php

示例3: add

 /**
  * @inheritDoc
  */
 public function add($blockId, ModelInterface $block)
 {
     $block->setOption('block_id', $blockId);
     if ($block->hasChildren()) {
         foreach ($block->getChildren() as $childBlock) {
             $childBlockId = $this->determineAnonymousBlockId($childBlock);
             $childBlock->setCaptureTo($blockId . LayoutInterface::CAPTURE_TO_DELIMITER . $childBlock->captureTo());
             $this->add($childBlockId, $childBlock);
         }
         if ($block instanceof ClearableModelInterface) {
             $block->clearChildren();
         }
     }
     $this->blocks[$blockId] = $block;
     return $this;
 }
开发者ID:hummer2k,项目名称:conlayout,代码行数:19,代码来源:BlockPool.php

示例4: searchTemplates

 /**
  * Recursively search a view model and it's children for the given templateName
  *
  * @param  \Zend\View\Model\ModelInterface $viewModel
  * @param  string    $templateName
  * @return boolean
  */
 protected function searchTemplates($viewModel, $templateName)
 {
     if ($viewModel->getTemplate($templateName) == $templateName) {
         return true;
     }
     foreach ($viewModel->getChildren() as $child) {
         return $this->searchTemplates($child, $templateName);
     }
     return false;
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:17,代码来源:AbstractControllerTestCase.php

示例5: render

 /**
  * Recursively processes all ViewModels and returns output.
  *
  * @param  string|ModelInterface   $model        A ViewModel instance.
  * @param  null|array|\Traversable $values       Values to use when rendering. If none
  *                                               provided, uses those in the composed
  *                                               variables container.
  * @return string Console output.
  */
 public function render($model, $values = null)
 {
     if (!$model instanceof ModelInterface) {
         return '';
     }
     $result = '';
     $options = $model->getOptions();
     foreach ($options as $setting => $value) {
         $method = 'set' . $setting;
         if (method_exists($this, $method)) {
             $this->{$method}($value);
         }
         unset($method, $setting, $value);
     }
     unset($options);
     $values = $model->getVariables();
     if (isset($values['result'])) {
         // filter and append the result
         $result .= $this->getFilterChain()->filter($values['result']);
     }
     if ($model->hasChildren()) {
         // recursively render all children
         foreach ($model->getChildren() as $child) {
             $result .= $this->render($child, $values);
         }
     }
     return $result;
 }
开发者ID:Flesh192,项目名称:magento,代码行数:37,代码来源:ConsoleRenderer.php

示例6: render

 /**
  * Recursively processes all ViewModels and returns output.
  *
  * @param string|ModelInterface $model A ViewModel instance.
  * @param null|array|\Traversable $values Values to use when rendering. If
  *     none provided, uses those in the composed variables container.
  * @return string Console output.
  */
 public function render($model, $values = null)
 {
     $result = '';
     if (!$model instanceof ModelInterface) {
         // View model is required by this renderer
         return $result;
     }
     // If option keys match setters, pass values to those methods.
     foreach ($model->getOptions() as $setting => $value) {
         $method = 'set' . $setting;
         if (method_exists($this, $method)) {
             $this->{$method}($value);
         }
     }
     // Render children first
     if ($model->hasChildren()) {
         // recursively render all children
         foreach ($model->getChildren() as $child) {
             $result .= $this->render($child, $values);
         }
     }
     // Render the result, if present.
     $values = $model->getVariables();
     if (isset($values['result']) && !isset($this->filterChain)) {
         // append the result verbatim
         $result .= $values['result'];
     }
     if (isset($values['result']) && isset($this->filterChain)) {
         // filter and append the result
         $result .= $this->getFilterChain()->filter($values['result']);
     }
     return $result;
 }
开发者ID:zendframework,项目名称:zend-mvc-console,代码行数:41,代码来源:Renderer.php


注:本文中的Zend\View\Model\ModelInterface::getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。