-
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
Tiny improvement on render() method in Magento\Backend\Block\Widget\Grid\Column\Ren... #667
Conversation
…Renderer\Concat which allows now calls to any method on a model. Configuration in adminhtml grid can look like this: ```php $this->addColumn('product_price', array( 'header' => __('RRP incl. Tax<br>Sales Prices incl. Tax'), 'getter' => ['returnProductPrice', 'getProductFinalPrice'], 'align' => 'right', 'type' => 'concat', 'separator' => '<br>', )); ``` or this ```php $this->addColumn('product_price2', array( 'header' => __('RRP incl. Tax<br>SP incl. Tax'), 'index' => ['product_price', 'product_final_price'], 'align' => 'right', 'type' => 'concat', 'separator' => '<br>', )); ```
$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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Crap PHP :-(
Indeed. Must use method_exists.
Thanks!
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.
method_exists is also not suitable, because it's cannot get data over magic getters
moreover, better to check that method starts from get to call only getters
$methods = $this->getColumn()->getGetter() ? $this->getColumn()->getGetter() : $this->getColumn()->getIndex(); | ||
foreach ($methods as $m) { | ||
if (true === is_callable([$row, $m])) { | ||
$data = call_user_func(array($row, $m), $this->getColumn()); |
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.
Magic setters in Magento Object expects the first parameter will be array keys compatible type.
Test shows it very well 😉
* Various improvements: * Implemented a general way of using RSS module * Created a cron job in the Customer module for cleaning the customer_visitor table * Added a warning message to the Use HTTP Only option in the Admin panel * Implemented the Grid component in the Magento UI Library * Reimplemented the URL Rewrites functionality in the new UrlRedirect module * Framework improvements: * Added the ability to install Magento 2 using CLI * Aggregated Magento installation and upgrade into one tool * Refactored CustomerService REST WebApi to be more RESTful * Increased unit and integration test coverage * Moved page asset management to page configuration API, and eliminated the \Magento\Theme\Block\Html\Head block * Eliminated the Root, Html and Title blocks * Themes update: * Removed widgets from the default Magento installation * Fixed bugs: * Fixed an issue with wishlist creation for non-registered customer * Fixed an issue with Google Mapping where Condition did not show correct value * Fixed an issue where there were too many notifications for admin user by default * Fixed a Daylight Savings Time calculation error * Fixed an issue where default cookie path and lifetime were not validated prior to saving * Fixed an issue where current admin password was not required for resetting admin password * Fixed an issue where custom customer attribute or customer address attribute was not accessible when custom_attribute is used as the attribute code * Fixed an issue where integration entity could not be deleted after being searched in grid * Fixed an issue where invalid parameter value was shown in SOAP * Fixed an issue where exception was thrown for Array to String conversion in SOAP * Fixed an issue where exception was thrown due to invalid argument supplied for foreach() statement in REST * Fixed an issue where admin tax notifications did not appear correctly in the System Messages dialog box * Fixed an issue where tax details were missing when viewing order in the Admin panel * Fixed an issue where styles for the storefront store selector were absent * Fixed an issue where customer got 404 page when switching store views on the product page of a product with different URL keys in different store views * Fixed an issue where the Add To Cart button in the MAP pop-up did not work for configurable and bundle products * Fixed an issue where for specifying options for configurable product was absent after adding a product from the MAP pop-up * Fixed an issue where a fatal error was thrown after selecting shipping method on PayPal Express Checkout * Fixed an issue with sending invoice email * Fixed an issue where integration tests failed with a fatal error * Fixed an issue where credit memo entry was not created after performing a refund for an order * Fixed an issue where categories layout for widgets did not work * Fixed an issue where opening a page restricted by ACL lead to blank page instead of the Access Denied page * Fixed an issue where a blank page was displayed instead of the using the Advanced Search result * Fixed an issue where the "Please wait" spinner was absent on Ajax requests for order creation in the Admin panel * Fixed an issue with the main navigation menu location on the page * Modularity: * Implemented the automatic applying of the MAP policy * Indexers: * Eliminated the old Magento_Index module * Search library * Added wildcards filter * Eliminated unused queries and filters * Added IN to Term filter * Moved the "value" attribute from <match> to <query> for the Match query * Refactored the usage of negation * Implemented Request Builder * CatalogSearch adapter * Pluginized adding attribute to search index * Merged base declaration with searchable attributes * Added the following Setup CLI tools in the setup folder * Deployment Configuration Tool * Schema Setup and Update Tool * DB Data Update Tool * Admin User Setup Tool * User Configuration Tool * Installation Tool * Update Tool * GitHub requests: * [#615] (#615) -- Use info as object in checkout_cart_update_items_before * [#659] (#659) -- Recently viewed products sidebar issue * [#660] (#660) -- RSS global setting * [#663] (#663) -- session.save_path not valid * [#445] (#445) -- use of registry in Magento\Tax\Helper\Data * [#646] (#646) -- Fixed flat category indexer bug * [#643] (#643) -- Configurable Products Performance * [#640] (#640) -- [Insight] Files should not be executable * [#667] (#667) -- Tiny improvement on render() method in Column/Renderer/Concat * [#288] (#288) -- Add Cell Phone to Customer Address Form * [#607] (#607) -- sitemap.xml filename is not variable * [#633] (#633) -- Fixed Typo ($_attribite -> $_attribute) * [#634] (#634) -- README.md contains broken link to X.commerce Agreement * [#569] (#569) -- ObjectManager's Factory should be replaceable depending on service * [#654] (#654) -- Demo notice overlapping * Functional tests: * Abandoned carts report * Adding products from wishlist to cart * Create invoice for offline payment methods * Delete products from shopping cart * Delete widget * Global search * Order count report * Order total report
[Mavericks] Created Web Api handlers and extended functional tests
[Kiwi] Prepare code base for 2.0.12
...derer\Concat which allows now calls to any method on a model. Which is a huge win!
Configuration in adminhtml grid can look like this:
or this
No tests added ...
Thanks for merging :-)