Frontend\Modules\FormBuilder\Engine\Model::get PHP Method

get() public static method

Get an item.
public static get ( string $id ) : array
$id string The id of the item to fetch.
return array
    public static function get($id)
    {
        $id = (int) $id;
        // get form
        $form = (array) FrontendModel::getContainer()->get('database')->getRecord('SELECT i.id, i.language, i.method, i.name, i.email, i.success_message, i.identifier
             FROM forms AS i
             WHERE i.id = ?', $id);
        // unserialize the recipients
        if (isset($form['email'])) {
            $form['email'] = (array) unserialize($form['email']);
        }
        // get validation
        $form['fields'] = self::getFields($id);
        return $form;
    }

Usage Example

Beispiel #1
0
 /**
  * Load the data.
  */
 private function loadData()
 {
     // fetch the item
     $this->item = FrontendFormBuilderModel::get((int) $this->data['id']);
     // define form name
     $this->formName = 'form' . $this->item['id'];
 }
All Usage Examples Of Frontend\Modules\FormBuilder\Engine\Model::get