Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AccountLock.php
Go to the documentation of this file.
1 <?php
7 
11 
15 class AccountLock extends Column
16 {
25  public function __construct(
28  array $components = [],
29  array $data = []
30  ) {
31  parent::__construct($context, $uiComponentFactory, $components, $data);
32  }
33 
40  public function prepareDataSource(array $dataSource)
41  {
42  if (isset($dataSource['data']['items'])) {
43  foreach ($dataSource['data']['items'] as & $item) {
44  if (array_key_exists('lock_expires', $item)) {
45  $lockExpires = new \DateTime($item['lock_expires']);
46  if ($lockExpires > new \DateTime()) {
47  $item['lock_expires'] = __('Locked');
48  } else {
49  $item['lock_expires'] = __('Unlocked');
50  }
51  } else {
52  $item['lock_expires'] = __('Unlocked');
53  }
54  }
55  }
56  return $dataSource;
57  }
58 }
__()
Definition: __.php:13
__construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, array $components=[], array $data=[])
Definition: AccountLock.php:25