我正在查看产品对象。如何获得其类型?
$view = Views::getView('get_all_products');
$view->execute();
foreach ($view->result as $row) { // products
$product = $row->_entity;
$product = \Drupal::service('entity.repository')->getTranslationFromContext($product); // Translating it
$productType = $product-> ????
...
我认为这是更好的解决方案:
$product_type = $product->bundle();
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句