Exemplo n.º 1
0
 /**
  * Returns the icon associated to a given file extension (privileging black and white).
  *
  * @param IconFactory $iconFactory
  * @param string $extension
  * @return string
  */
 protected static function getIconForFileExtension($extension, IconFactory $iconFactory)
 {
     switch ($extension) {
         case 'html':
         case 'pdf':
             $iconHtml = $iconFactory->getIcon('actions-file-' . $extension, Icon::SIZE_SMALL)->render();
             break;
         case 'sxw':
             $iconHtml = $iconFactory->getIcon('actions-file-openoffice', Icon::SIZE_SMALL)->render();
             break;
         case 'json':
             $iconHtml = $iconFactory->getIcon('actions-system-extension-documentation', Icon::SIZE_SMALL)->render();
             break;
         default:
             $iconHtml = $iconFactory->getIconForFileExtension($extension, Icon::SIZE_SMALL)->render();
     }
     return $iconHtml;
 }
Exemplo n.º 2
0
 /**
  * Tests the return of an icon for a file with extension png
  *
  * @test
  */
 public function getIconForFileWithFileTypePngReturnsPngIcon()
 {
     $this->assertContains('<span class="t3js-icon icon icon-size-default icon-state-default icon-mimetypes-media-image" data-identifier="mimetypes-media-image">', $this->subject->getIconForFileExtension('png')->render());
 }