public function AppForm::form in Apigee Edge 8
Gets the actual form array to be built.
Overrides FieldableEdgeEntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
2 calls to AppForm::form()
- AppCreateForm::form in src/
Entity/ Form/ AppCreateForm.php - Gets the actual form array to be built.
- AppEditForm::form in src/
Entity/ Form/ AppEditForm.php - Gets the actual form array to be built.
2 methods override AppForm::form()
- AppCreateForm::form in src/
Entity/ Form/ AppCreateForm.php - Gets the actual form array to be built.
- AppEditForm::form in src/
Entity/ Form/ AppEditForm.php - Gets the actual form array to be built.
File
- src/
Entity/ Form/ AppForm.php, line 54
Class
- AppForm
- Base entity form for developer- and team (company) app create/edit forms.
Namespace
Drupal\apigee_edge\Entity\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['#tree'] = TRUE;
/** @var \Drupal\apigee_edge\Entity\AppInterface $app */
$app = $this->entity;
// By default we render this as a simple text field, sub-classes can change
// this.
$form['owner'] = [
'#title' => $this
->t('Owner'),
'#description' => $this
->t("A developer's id (uuid), email address or a team's (company's) name."),
'#type' => 'textfield',
'#weight' => -100,
'#default_value' => $app
->getAppOwner(),
'#required' => TRUE,
];
$form['name'] = [
'#type' => 'machine_name',
'#machine_name' => [
'source' => [
'displayName',
'widget',
0,
'value',
],
'label' => $this
->t('Internal name'),
'exists' => [
$this,
'appExists',
],
],
'#title' => $this
->t('Internal name'),
// It should/can not be changed if app is not new.
'#disabled' => !$app
->isNew(),
'#default_value' => $app
->getName(),
];
$form['#attached']['library'][] = 'apigee_edge/apigee_edge.components';
$form['#attributes']['class'][] = 'apigee-edge--form';
return $form;
}