Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, $aid = NULL)
 {
     $attribute = uc_attribute_load($aid);
     $form = parent::buildForm($form, $form_state, $aid);
     $form['#title'] = $this->t('Options for %name', ['%name' => $attribute->name]);
     return $form;
 }
Пример #2
0
 /**
  * {@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;
 }