<?php

namespace GriffinForms\Admin\Sql;

class Message extends \GriffinForms\Admin\Sql\Format
{
    public function getFormContextOptions(): array
    {
        global $wpdb;

        $forms_table = $this->config->getTable('form');
        if (empty($forms_table)) {
            return [];
        }

        $rows = $wpdb->get_results(
            $wpdb->prepare(
                'SELECT id, name, heading FROM %i ORDER BY id DESC',
                $forms_table
            )
        );

        return is_array($rows) ? $rows : [];
    }
}
