Skip to content

Commit

Permalink
Merge pull request #35 from storypioneers/develop
Browse files Browse the repository at this point in the history
Merge 1.5.1
  • Loading branch information
JonasDoebertin committed Nov 17, 2015
2 parents dd7a87a + 9ab41d3 commit da82bc6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Version 1.5.1

**Bugfixes:**

* More compatible way of getting the current panel language

## Version 1.5.0

**Features:**
Expand Down
16 changes: 12 additions & 4 deletions selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

/**
* Selector.
*
*
* Fileselect Field for Kirby 2
*
* @version 1.5.0
* @version 1.5.1
* @author digital storytelling pioneers <[email protected]>
* @author feat. Jonas Döbertin <[email protected]>
* @copyright digital storytelling pioneers <[email protected]>
Expand Down Expand Up @@ -143,9 +143,17 @@ class SelectorField extends BaseField
*/
public function __construct()
{
// Load language files
// Build translation file path
$baseDir = __DIR__ . DS . self::LANG_DIR . DS;
$lang = panel()->language();

// Get panel language
if (version_compare(panel()->version(), '2.2', '>=')) {
$lang = panel()->translation()->code();
} else {
$lang = panel()->language();
}

// Load language files
if (file_exists($baseDir . $lang . '.php')) {
require $baseDir . $lang . '.php';
} else {
Expand Down
4 changes: 2 additions & 2 deletions template.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="item-content">
<?php if ($file->type() == 'image'): ?>
<figure class="item-image">
<?php if (version_compare(Kirby::version(), '2.2', '>=')): ?>
<?php if (version_compare(panel()->version(), '2.2', '>=')): ?>
<a class="btn btn-with-icon" data-context="<?= purl($file, 'context') ?>" href="#options" title="<?= l('pages.show.subpages.edit') ?>">
<?= thumb($file, array('width' => 48, 'height' => 48, 'crop' => true)) ?>
</a>
Expand Down Expand Up @@ -43,7 +43,7 @@
<nav class="item-options">
<ul class="nav nav-bar">
<li>
<?php if (version_compare(Kirby::version(), '2.2', '>=')): ?>
<?php if (version_compare(panel()->version(), '2.2', '>=')): ?>
<a class="btn btn-with-icon" data-context="<?= purl($file, 'context') ?>" href="#options" title="<?= l('pages.show.subpages.edit') ?>">
<i class="icon icon-left fa fa-pencil"></i>
<span><?= l('pages.show.subpages.edit') ?></span>
Expand Down

0 comments on commit da82bc6

Please sign in to comment.