コード例 #1
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $citeProcessor = Yii::createObject('CiteProcessor');
     $citeProcessor->init($this->csl, $this->locale);
     $mapper = new CiteProcMapper($this->model);
     $reference = $mapper->map();
     $references[$this->model->id] = $reference;
     return $this->render('citation', ['widgetId' => $this->getId(), 'reference' => $reference, 'row' => function ($reference, $mode) use($citeProcessor) {
         return $citeProcessor->render($reference, $mode);
     }]);
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $citeProcessor = Yii::createObject('CiteProcessor');
     $citeProcessor->init($this->csl, $this->locale);
     $references = [];
     foreach ($this->dataProvider->getModels() as $model) {
         $mapper = new CiteProcMapper($model);
         $reference = $mapper->map();
         $references[$model->id] = $reference;
     }
     return $this->render('bibliography', ['widgetId' => $this->getId(), 'references' => $references, 'row' => function ($reference, $mode) use($citeProcessor) {
         return $citeProcessor->render($reference, $mode);
     }]);
 }