ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 9583


Ignore:
Timestamp:
Dec 18, 2008, 1:57:53 AM (13 years ago)
Author:
ebihara
Message:

#3215:added support to template customizing for using component

Location:
OpenPNE3/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/config/sfOpenPNEViewConfigHandler.class.php

    r8567 r9583  
    9191      $target .= ')';
    9292
    93       $data .= "  \$this->setCustomize('$name', '{$template[0]}', '{$template[1]}', $category, $parts, $target);\n";
     93      $isComponent = 'false';
     94      if (!empty($customize['is_component']))
     95      {
     96        $isComponent = 'true';
     97      }
     98
     99      $data .= "  \$this->setCustomize('$name', '{$template[0]}', '{$template[1]}', $category, $parts, $target, $isComponent);\n";
    94100      $data .= "  if (sfConfig::get('sf_logging_enabled')) \$this->context->getEventDispatcher()->notify(new sfEvent(\$this, 'application.log', array(sprintf('Set customize \"%s\" (%s/%s)', '$name', '{$template[0]}', '{$template[1]}'))));\n";
    95101    }
  • OpenPNE3/trunk/lib/helper/PartsHelper.php

    r9510 r9583  
    100100  $lastActionStack = $context->getActionStack()->getLastEntry();
    101101
    102 
    103102  $content = '';
    104103  foreach ($customizes as $customize) {
     
    107106      $moduleName = $lastActionStack->getModuleName();
    108107    }
    109     $actionName = '_'.$customize[1];
    110     $view = new sfPartialView($context, $moduleName, $actionName, '');
    111     $view->setPartialVars($lastActionStack->getActionInstance()->getVarHolder()->getAll());
    112     if (_is_disabled_plugin_dir($view->getDirectory())) {
    113       continue;
     108    $actionName = $customize[1];
     109    $vars = $lastActionStack->getActionInstance()->getVarHolder()->getAll();
     110
     111    if ($customize[2])
     112    {
     113      $content .= get_component($moduleName, $actionName, $vars);
    114114    }
    115     $content .= $view->render();
     115    else
     116    {
     117      $templateName = $moduleName.'/'.$actionName;
     118      $content .= get_partial($templateName, $vars);
     119    }
    116120  }
    117121
  • OpenPNE3/trunk/lib/view/sfOpenPNEView.class.php

    r8567 r9583  
    2525  public $customizeTemplates = array();
    2626
     27  protected $customizeComponents = array();
     28
    2729  /**
    2830   * Sets the customize.
     
    3436   * @param array  $partsNames     Parts names
    3537   * @param array  $targetNames    Target names
     38   * @param bool   $isComponent
    3639   */
    37   public function setCustomize($attributeName, $moduleName, $templateName, $categoryNames, $partsNames, $targetNames)
     40  public function setCustomize($attributeName, $moduleName, $templateName, $categoryNames, $partsNames, $targetNames, $isComponent = false)
    3841  {
    3942    if (empty($categoryNames))
     
    7376    }
    7477
    75     $this->customizeTemplates[$attributeName] = array($moduleName, $templateName);
     78    $this->customizeTemplates[$attributeName] = array($moduleName, $templateName, $isComponent);
    7679  }
    7780
  • OpenPNE3/trunk/test/unit/config/sfOpenPNEViewConfigHandlerTest.php

    r8570 r9583  
    3535
    3636$content = <<<EOF
    37   \$this->setCustomize('first', '', 'first', array(), array(), array());  if (sfConfig::get('sf_logging_enabled')) \$this->context->getEventDispatcher()->notify(new sfEvent(\$this, 'application.log', array(sprintf('Set customize "%s" (%s/%s)', 'first', '', 'first'))));
     37  \$this->setCustomize('first', '', 'first', array(), array(), array(), false);  if (sfConfig::get('sf_logging_enabled')) \$this->context->getEventDispatcher()->notify(new sfEvent(\$this, 'application.log', array(sprintf('Set customize "%s" (%s/%s)', 'first', '', 'first'))));
    3838EOF;
    3939$t->is(strip_cl($h->addCustomizes('myView')), strip_cl($content), 'addCustomizes() basic customize addition');
Note: See TracChangeset for help on using the changeset viewer.