コード例 #1
0
ファイル: Sluggable.php プロジェクト: grrr-amsterdam/garp3
 public function getParams()
 {
     $params = parent::getParams();
     $defaultParams = $this->getDefaultParams();
     foreach ($defaultParams as $paramName => $paramValue) {
         if (!array_key_exists($paramName, $params)) {
             $params[$paramName] = $paramValue;
         }
     }
     return $params;
 }
コード例 #2
0
ファイル: Draftable.php プロジェクト: grrr-amsterdam/garp3
 public function __construct(Garp_Spawn_Model_Abstract $model, $origin, $name, $params = null, $type = null)
 {
     if (!empty($params['default'])) {
         $this->_setStatusDefault($params['default']);
     }
     // Use only the online_status part of Draftable, discard published
     if (!empty($params['draft_only'])) {
         unset($this->_fields['published']);
     }
     parent::__construct($model, $origin, $name, $params, $type);
 }
コード例 #3
0
ファイル: Base.php プロジェクト: grrr-amsterdam/garp3
 protected function _renderBehavior(Garp_Spawn_Behavior_Type_Abstract $behavior)
 {
     $module = $behavior->getModule();
     $name = $behavior->getName();
     $type = $behavior->getType();
     $params = $name === 'Weighable' ? $behavior->getNonHabtmParams() : $behavior->getParams();
     if ($params || !in_array($name, $this->_behaviorsThatRequireParams)) {
         $paramsString = is_array($params) ? Garp_Spawn_Util::array2phpStatement($params) : null;
         return "\$this->registerObserver(new {$module}_Model_{$type}_{$name}({$paramsString}));";
     }
 }