2017 © Pedro Peláez
 

yii2-extension yii2-file-icons

Widget for getting the font-icon for file extension

image

black-lamp/yii2-file-icons

Widget for getting the font-icon for file extension

  • Tuesday, February 21, 2017
  • by GutsVadim
  • Repository
  • 2 Watchers
  • 0 Stars
  • 71 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 4 Versions
  • 11 % Grown

The README.md

File icons widget for Yii2

Widget for getting the font-icon for file extension, (*1)

Build Status Latest Stable Version Latest Unstable Version License, (*2)

Installation

Run command, (*3)

composer require black-lamp/yii2-file-icons

or add, (*4)

"black-lamp/yii2-file-icons": "^1.0.0"

to the require section of your composer.json., (*5)

Using

Example of using, (*6)

$widget = \bl\files\icons\FileIconWidget::begin([
    'icons' => [
        'txt' => [
            'icon' => \yii\helpers\Html::tag('i', '', ['class' => 'icon-file-txt'])
        ],
        'groups' => [
            [
                'extensions' => ['jpg', 'png', 'gif'],
                'icon' => \yii\helpers\Html::tag('i', '', ['class' => 'icon-picture'])
            ],
        ]
    ]
]);
echo $widget->getIcon('image.jpg');
$widget->end();

Method FileIconWidget::getIcon() takes file extension, file name or full path to file and returns icon for file extension. Icon - method gets from configuration array. If icon not found in configuration array method returns empty icon. Empty icon value gets from emptyIcon widget option., (*7)

Widget configuration properties

Option Description Type Default
icons Array with configuration for file extensions and icons array -
useDefaultIcons If set true - widget will be user default icons for files boolean false
emptyIcon If icon will not be found if icons array or in defaul icons set - value from this property will be returned string 'Icon for this extension not found!'

Default icon set

If you set widget option useDefaultIcons in true - method FileIconWidget::getIcon() will be returns default icons for file extensions. Also you can override default icons if you dont't wont to use default icon for curren file extension. Default icon set, (*8)

<i class="file-text"></i>
<i class="file-pdf"></i>
<i class="file-power-point"></i>
<i class="file-archive"></i>
<i class="file-word"></i>
<i class="file-excel"></i>
<i class="file-picture"></i>
<i class="file-video"></i>
<i class="file-code"></i>

or using \bl\files\icons\helpers\IconHelper, (*9)

IconHelper::icon('text');
IconHelper::icon('pdf');
IconHelper::icon('power-point');
IconHelper::icon('archive');
IconHelper::icon('word');
IconHelper::icon('excel');
IconHelper::icon('picture');
IconHelper::icon('video');
IconHelper::icon('code');

The Versions

21/02 2017

dev-master

9999999-dev

Widget for getting the font-icon for file extension

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Kuprienko

file yii2 widget icon files icons

21/02 2017

1.0.2

1.0.2.0

Widget for getting the font-icon for file extension

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Kuprienko

file yii2 widget icon files icons

08/02 2017

1.0.1

1.0.1.0

Widget for getting the font-icon for file extension

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Kuprienko

file yii2 widget icon files icons

23/01 2017

1.0.0

1.0.0.0

Widget for getting the font-icon for file extension

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Kuprienko

file yii2 widget icon files icons