Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function zimo_schema() {
- $schema['zimo'] = array(
- 'description' => 'Stores example person entries for demonstration purposes.',
- 'fields' => array(
- 'pid' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique person ID.',
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'paiddate' => array(
- 'type' => 'date',
- ),
- 'amount' => array(
- 'type' => 'bigint',
- ),
- ),
- 'primary key' => array('pid'),
- );
- return $schema;
- }
- namespace DrupalzimoForm;
- use DrupalCoreFormFormBase;
- use DrupalCoreFormFormStateInterface;
- use DrupalzimoZimoStorage;
- /**
- * Simple form to add an entry, with all the interesting fields.
- */
- class ZimoAddForm extends FormBase {
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'zimo_add_form';
- }
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- $form = array();
- $form['message'] = array(
- '#markup' => $this->t('Add an entry to the Zimo Database table.'),
- );
- $form['add'] = array(
- '#type' => 'fieldset',
- '#title' => t('Add a person entry'),
- );
- $form['add']['name'] = array(
- '#type' => 'textfield',
- '#title' => t('Name'),
- '#size' => 15,
- );
- $form['add']['paiddate'] = array(
- '#type' => 'date',
- '#title' => t('Paid Date'),
- );
- $form['add']['amount'] = array(
- '#type' => 'textfield',
- '#title' => t('Paid Amount')
- );
- $form['add']['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Add'),
- );
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement