SearchResult.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Theme\Ui\Component\Theme\DataProvider;
  8. /**
  9. * Theme search result
  10. */
  11. class SearchResult extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult
  12. {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. protected $_map = [
  17. 'fields' => [
  18. 'theme_id' => 'main_table.theme_id',
  19. 'theme_title' => 'main_table.theme_title',
  20. 'theme_path' => 'main_table.theme_path',
  21. 'parent_theme_title' => 'parent.theme_title',
  22. ],
  23. ];
  24. /**
  25. * Add area and type filters
  26. * Join parent theme title
  27. *
  28. * @return $this
  29. */
  30. protected function _initSelect()
  31. {
  32. parent::_initSelect();
  33. $this
  34. ->addFieldToFilter('main_table.area', \Magento\Framework\App\Area::AREA_FRONTEND)
  35. ->addFieldToFilter('main_table.type', ['in' => [
  36. \Magento\Framework\View\Design\ThemeInterface::TYPE_PHYSICAL,
  37. \Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL,
  38. ]])
  39. ;
  40. $this->getSelect()->joinLeft(
  41. ['parent' => $this->getMainTable()],
  42. 'main_table.parent_id = parent.theme_id',
  43. ['parent_theme_title' => 'parent.theme_title']
  44. );
  45. return $this;
  46. }
  47. }