Skip to content

Commit

Permalink
Hide properties irrelevant for groups (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Mar 6, 2019
1 parent 2f75297 commit 4a0bbed
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Definition/EntityDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
namespace Volkszaehler\Definition;

use Volkszaehler\Util;
use Volkszaehler\Model\Aggregator;

/**
* @author Steffen Vogel <info@steffenvogel.de>
* @author Andreas Goetz <cpuidle@gmx.de>
* @package default
*/
class EntityDefinition extends Definition {
/**
Expand Down Expand Up @@ -107,6 +110,7 @@ class EntityDefinition extends Definition {
*/
static protected $defaultRequired = array('title');
static protected $defaultOptional = array('public', 'color', 'style', 'fillstyle', 'yaxis', 'active', 'description', 'owner', 'address:', 'link');
static protected $groupOptional = array('public', 'color', 'active', 'description', 'owner', 'address:', 'link');

/**
* Constructor
Expand All @@ -117,7 +121,11 @@ protected function __construct($object) {
parent::__construct($object);

$this->required = array_merge(self::$defaultRequired, $this->required);
$this->optional = array_merge(self::$defaultOptional, $this->optional);

$optional = $this->getModel() == Aggregator::class
? self::$groupOptional
: self::$defaultOptional;
$this->optional = array_merge($optional, $this->optional);
}

/*
Expand Down

0 comments on commit 4a0bbed

Please sign in to comment.