Skip to content

Commit

Permalink
56183-Optimize-columns-on-list-views-for-forms-estates-and-addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
TangHien4698 committed Jan 12, 2022
1 parent 68246c1 commit 500acc0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 79 deletions.
26 changes: 0 additions & 26 deletions plugin/Gui/Table/AddressListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,6 @@ private function fillData()
]);
}

private function handleRecord($listRecord)
{
if (empty($listRecord))
{
return [];
}
foreach ($listRecord as &$record)
{
if (!empty($record->page_shortcode))
{
$listPageID = explode(',',$record->page_shortcode);
$page = '';
foreach ($listPageID as $pageID)
{
if (!empty($page))
{
$page .= ',';
}
$page .= "<a href='".get_edit_post_link((int)$pageID)."' target='_blank'>".get_the_title((int)$pageID)."</a>";
}
$record->page_shortcode = $page;
}
}
return $listRecord;
}

/**
*
* @return array
Expand Down
28 changes: 0 additions & 28 deletions plugin/Gui/Table/EstateListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,34 +124,6 @@ private function fillData()
]);
}

private function handleRecord($listRecord)
{
if (empty($listRecord))
{
return [];
}
$recordEstate = [];
foreach ($listRecord as $record)
{
if (!empty($record->page_shortcode))
{
$listPageID = explode(',',$record->page_shortcode);
$page = '';
foreach ($listPageID as $pageID)
{
if (!empty($page))
{
$page .= ',';
}
$page .= "<a href='".esc_attr(get_edit_post_link((int)$pageID))."' target='_blank'>".esc_html(get_the_title((int)$pageID))."</a>";
}
$record->page_shortcode = $page;
}
$recordEstate[] = $record;
}
return $recordEstate;
}

/**
*
*/
Expand Down
25 changes: 0 additions & 25 deletions plugin/Gui/Table/FormsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,31 +116,6 @@ private function fillData()
$this->_countByType = $pRecordRead->getCountByType();
}

private function handleRecord($listRecord)
{
if (empty($listRecord))
{
return [];
}
foreach ($listRecord as &$record)
{
if (!empty($record->page_shortcode))
{
$listPageID = explode(',',$record->page_shortcode);
$page = '';
foreach ($listPageID as $pageID)
{
if (!empty($page))
{
$page .= ',';
}
$page .= "<a href='".get_edit_post_link((int)$pageID)."' target='_blank'>".get_the_title((int)$pageID)."</a>";
}
$record->page_shortcode = $page;
}
}
return $listRecord;
}

/**
*
Expand Down
27 changes: 27 additions & 0 deletions plugin/Gui/Table/WP/ListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,31 @@ protected function setItems(array $items)
/** @return array */
protected function getItems()
{ return $this->items; }

protected function handleRecord(array $records)
{
if (empty($records))
{
return [];
}
$recordHandled = [];
foreach ($records as $record)
{
if (!empty($record->page_shortcode))
{
$listPageID = explode(',',$record->page_shortcode);
$pages = '';
$listPage = [];
foreach ($listPageID as $pageID)
{
$listPage[] = "<a href='".esc_attr(get_edit_post_link((int)$pageID))."' target='_blank'>".esc_html(get_the_title((int)$pageID))."</a>";
}
$pages = implode(',',$listPage);
$record->page_shortcode = $pages;
}
$recordHandled[] = $record;
}
return $recordHandled;
}

}

0 comments on commit 500acc0

Please sign in to comment.