function commerce_product_post_update_4 in Commerce Core 8.2
Expose the status field on every product form.
File
- modules/
product/ commerce_product.post_update.php, line 63 - Post update functions for Product.
Code
function commerce_product_post_update_4() {
$query = \Drupal::entityQuery('entity_form_display')
->condition('targetEntityType', 'commerce_product');
$ids = $query
->execute();
$form_displays = EntityFormDisplay::loadMultiple($ids);
foreach ($form_displays as $id => $form_display) {
/** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $form_display */
$form_display
->setComponent('status', [
'type' => 'boolean_checkbox',
'settings' => [
'display_label' => TRUE,
],
])
->save();
}
}