Condition.php 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Layout\Condition;
  7. /**
  8. * Composite condition which iterate over included conditions.
  9. */
  10. class Condition
  11. {
  12. /**
  13. * @var VisibilityConditionInterface[]
  14. */
  15. private $conditions;
  16. /**
  17. * @param VisibilityConditionInterface[] $conditions
  18. */
  19. public function __construct(array $conditions)
  20. {
  21. $this->conditions = $conditions;
  22. }
  23. /**
  24. * Validate logical condition for ui component
  25. * If validation passed block will be displayed
  26. *
  27. * @param array $arguments Attributes from element node.
  28. *
  29. * @return bool
  30. */
  31. public function isVisible(array $arguments)
  32. {
  33. foreach ($this->conditions as $condition) {
  34. if (!$condition->isVisible($arguments[$condition->getName()]['arguments'])) {
  35. return false;
  36. }
  37. }
  38. return true;
  39. }
  40. }