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


PHP ContentObjectRenderer::setCurrentFile方法代码示例

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


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

示例1: getDataWithTypeFileReturnsUidOfFileObject

	/**
	 * Basic check if getData gets the uid of a file object
	 *
	 * @test
	 */
	public function getDataWithTypeFileReturnsUidOfFileObject() {
		$uid = $this->getUniqueId();
		$file = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', FALSE);
		$file->expects($this->once())->method('getUid')->will($this->returnValue($uid));
		$this->subject->setCurrentFile($file);
		$this->assertEquals($uid, $this->subject->getData('file:current:uid'));
	}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例2: renderLinktypeFile

 /**
  * Render link of type file
  *
  * @param array $lConf
  * @return array
  */
 private function renderLinktypeFile($lConf)
 {
     $viewAssign = array();
     // Get file
     $fileRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
     $fileObjects = $fileRepository->findByRelation('tt_content', 'mfp_image', $this->data['uid']);
     /** @var \TYPO3\CMS\Core\Resource\File $file */
     $file = $fileObjects[0];
     if (!empty($file)) {
         // Configure the image
         $this->cObj->setCurrentFile($file);
         $imageConf = $GLOBALS['TSFE']->tmpl->setup['lib.']['tx_jhmagnificpopup_pi1.']['image.'];
         $imageConf['file.']['treatIdAsReference'] = 1;
         $imageConf['file'] = $file;
         if (!empty($this->settings['mfpOption']['file_width'])) {
             $imageConf["file."]["maxW"] = $this->settings['mfpOption']['file_width'];
         }
         if (!empty($this->settings['mfpOption']['file_height'])) {
             $imageConf["file."]["maxH"] = $this->settings['mfpOption']['file_height'];
         }
         // Render image
         $theImgCode = $this->cObj->IMAGE($imageConf);
         // Get image orientation
         switch ($this->settings['mfpOption']['file_orient']) {
             case 1:
                 $viewAssign['imageorient'] = 'right';
                 break;
             case 2:
                 $viewAssign['imageorient'] = 'left';
                 break;
             case 0:
             default:
                 $viewAssign['imageorient'] = 'center';
         }
         // Get image description/caption
         $viewAssign['imagecaption'] = $file->getProperty('description');
         // Render typolink
         $viewAssign['tsLink'] = $this->cObj->typolink($theImgCode, $lConf);
     } else {
         $this->addFlashMessage('Please select an image', 'No image', AbstractMessage::WARNING);
     }
     return $viewAssign;
 }
开发者ID:Ducrot,项目名称:ext-jh_magnificpopup,代码行数:49,代码来源:MagnificpopupController.php


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