-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tiny improvement on render() method in Magento\Backend\Block\Widget\Grid\Column\Ren... #667
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,15 @@ class Concat extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract | |
*/ | ||
public function render(\Magento\Framework\Object $row) | ||
{ | ||
$dataArr = array(); | ||
foreach ($this->getColumn()->getIndex() as $index) { | ||
if ($data = $row->getData($index)) { | ||
$dataArr = []; | ||
$methods = $this->getColumn()->getGetter() ? $this->getColumn()->getGetter() : $this->getColumn()->getIndex(); | ||
foreach ($methods as $m) { | ||
if (true === is_callable([$row, $m])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is_callable always return true for class with __call method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Crap PHP :-( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. method_exists is also not suitable, because it's cannot get data over magic getters |
||
$data = call_user_func(array($row, $m), $this->getColumn()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Magic setters in Magento Object expects the first parameter will be array keys compatible type. |
||
} else { | ||
$data = $row->getData($m); | ||
} | ||
if (false === empty($data)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that !empty() is more understandable |
||
$dataArr[] = $data; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will more readable as