Skip to content

Commit 3b62535

Browse files
committed
MAGETWO-65470: The visibility conditions improvements
Rename andcondition to general condition.
1 parent 2eaa30e commit 3b62535

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

lib/internal/Magento/Framework/View/Layout/Condition/AndCondition.php renamed to lib/internal/Magento/Framework/View/Layout/Condition/Condition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Composite condition which iterate over included conditions.
1010
*/
11-
class AndCondition
11+
class Condition
1212
{
1313
/**
1414
* @var VisibilityConditionInterface[]

lib/internal/Magento/Framework/View/Layout/Condition/AndConditionFactory.php renamed to lib/internal/Magento/Framework/View/Layout/Condition/ConditionFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Factory for composite.
1212
*/
13-
class AndConditionFactory
13+
class ConditionFactory
1414
{
1515
/**
1616
* @var ObjectManagerInterface
@@ -28,14 +28,14 @@ public function __construct(ObjectManagerInterface $objectManager)
2828
/**
2929
* @param array $elementVisibilityConditions
3030
*
31-
* @return AndCondition
31+
* @return Condition
3232
*/
3333
public function create(array $elementVisibilityConditions)
3434
{
3535
$conditions = [];
3636
foreach ($elementVisibilityConditions as $condition) {
3737
$conditions[] = $this->objectManager->create($condition['name']);
3838
}
39-
return $this->objectManager->create(AndCondition::class, ['conditions' => $conditions]);
39+
return $this->objectManager->create(Condition::class, ['conditions' => $conditions]);
4040
}
4141
}

lib/internal/Magento/Framework/View/Layout/GeneratorPool.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Framework\View\Layout;
77

8-
use Magento\Framework\View\Layout\Condition\AndConditionFactory;
8+
use Magento\Framework\View\Layout\Condition\ConditionFactory;
99

1010
/**
1111
* Pool of generators for structural elements
@@ -28,24 +28,24 @@ class GeneratorPool
2828
protected $logger;
2929

3030
/**
31-
* @var \Magento\Framework\View\Layout\Condition\AndConditionFactory
31+
* @var \Magento\Framework\View\Layout\Condition\ConditionFactory
3232
*/
33-
private $andConditionFactory;
33+
private $conditionFactory;
3434

3535
/**
3636
* @param ScheduledStructure\Helper $helper
37-
* @param AndConditionFactory $andConditionFactory
37+
* @param ConditionFactory $conditionFactory
3838
* @param \Psr\Log\LoggerInterface $logger
3939
* @param array $generators
4040
*/
4141
public function __construct(
4242
ScheduledStructure\Helper $helper,
43-
AndConditionFactory $andConditionFactory,
43+
ConditionFactory $conditionFactory,
4444
\Psr\Log\LoggerInterface $logger,
4545
array $generators = null
4646
) {
4747
$this->helper = $helper;
48-
$this->andConditionFactory = $andConditionFactory;
48+
$this->conditionFactory = $conditionFactory;
4949
$this->logger = $logger;
5050
$this->addGenerators($generators);
5151
}
@@ -123,8 +123,8 @@ protected function buildStructure(ScheduledStructure $scheduledStructure, Data\S
123123
array_key_exists('visibilityConditions', $data['attributes']) &&
124124
!empty($data['attributes']['visibilityConditions'])
125125
) {
126-
$andCondition = $this->andConditionFactory->create($data['attributes']['visibilityConditions']);
127-
if (!$andCondition->isVisible($data['attributes']['visibilityConditions'])) {
126+
$condition = $this->conditionFactory->create($data['attributes']['visibilityConditions']);
127+
if (!$condition->isVisible($data['attributes']['visibilityConditions'])) {
128128
$this->removeElement($scheduledStructure, $structure, $name);
129129
}
130130
}

0 commit comments

Comments
 (0)