<?php
namespace Drupal\restaurant_bookings\Form;



class Notes
{
    
    public function __construct()
    {
        $this->conn = \Drupal::database();
    }
    
   
    public function getNotes(&$form)
    {
        $form['notes'] = array(
            '#type' => 'fieldset',
            '#title' => 'Special Requirements',
            '#collapsible' => true,
            '#collapsed' => false
        );
        
        $requirements = $this->conn->query("SELECT * FROM restaurant_requirements")->fetchAll();
        if (! empty('requirements')) {
            
            $options = array();
            foreach ($requirements as $val) {
                $options[$val->id] = $val->requirement;
            }
            $form['notes']['checkrequirements'] = array(
                '#type' => 'checkboxes',
                '#options' => $options
            );
        } 
        $form['notes']['requirements'] = array(
            '#type' => 'textarea',
            '#description' => 'Notes',
            '#title' => "Other: Please Specify"
        );
    }
}

