/**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, $aid = NULL, $oid = NULL)
 {
     $option = uc_attribute_option_load($oid);
     $form = parent::buildForm($form, $form_state, $aid);
     $form['#title'] = $this->t('Edit option: %name', ['%name' => $option->name]);
     $form['oid'] = array('#type' => 'value', '#value' => $option->oid);
     $form['name']['#default_value'] = $option->name;
     $form['ordering']['#default_value'] = $option->ordering;
     $form['cost']['#default_value'] = $option->cost;
     $form['price']['#default_value'] = $option->price;
     $form['weight']['#default_value'] = $option->weight;
     return $form;
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, $aid = NULL, $oid = NULL)
 {
     $this->option = uc_attribute_option_load($oid);
     return parent::buildForm($form, $form_state);
 }
 /**
  * Tests the "delete attribute option" user interface.
  */
 public function testAttributeUIAttributeOptionsDelete()
 {
     $attribute = $this->createAttribute();
     $option = $this->createAttributeOption(array('aid' => $attribute->aid));
     uc_attribute_option_save($option);
     $this->drupalGet('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/delete');
     $this->assertText(t('Are you sure you want to delete the option @name?', ['@name' => $option->name]), 'Attribute options delete form working.');
     $this->drupalPostForm('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/delete', array(), t('Delete'));
     $option = uc_attribute_option_load($option->oid);
     $this->assertFalse($option, 'Attribute option deleted successfully by form');
 }