ProductAttributesForm.php in Ubercart 8.4
File
uc_attribute/src/Form/ProductAttributesForm.php
View source
<?php
namespace Drupal\uc_attribute\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\NodeInterface;
class ProductAttributesForm extends ObjectAttributesFormBase {
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL) {
$this->attributeTable = 'uc_product_attributes';
$this->optionTable = 'uc_product_options';
$this->idField = 'nid';
$this->idValue = $node
->id();
$this->attributes = uc_product_get_attributes($this->idValue);
return parent::buildBaseForm($form, $form_state);
}
protected function attributesRemoved() {
\Drupal::database()
->delete('uc_product_adjustments')
->condition('nid', $this->idValue)
->execute();
}
}