This is not what ModelAdmins are for. They are meant to manage your dataobjects.
That said, I could only think of two solutions:
Filtering the gridfield and limiting it to one datarecord.
Your dataobject
class Contact extends DataObject
{
private static $db = [
'Name' => 'Varchar',
'Phone' => 'Varchar',
'Email' => 'Varchar'
// etc, etc
];
}
Your ModelAdmin
class ContactModelAdmin extends ModelAdmin
{
private static $managed_models = array(
'Contact'
);
private static $url_segment = 'contact';
private static $menu_title = 'My Contact Admin';
public function getList()
{
$list = parent::getList();
$list = $list->filter('Name', 'EagleEye')->limit(1);
return $list;
}
}
Or you might just wanna get rid of the gridfield and create some formfields, which you can populate.
class ContactModelAdmin extends ModelAdmin
{
private static $managed_models = array(
'Contact'
);
private static $url_segment = 'contact';
private static $menu_title = 'My Contact Admin';
public function getEditForm($id = null, $fields = null) {
$form = parent::getEditForm($id, $fields);
$gridFieldName = $this->sanitiseClassName($this->modelClass);
$form->Fields()->removeByName($gridFieldName);
$form->Fields()->push(
TextField::create('Name', 'Name', 'EagleEye')
->performReadonlyTransformation()
);
$form->Fields()->push(
TextField::create('Phone', 'Phone', '0123456789')
->performReadonlyTransformation()
);
$form->Fields()->push(
TextField::create('Email', 'Email', '[email protected]')
->performReadonlyTransformation()
);
return $form;
}
}
I hope this was what you were looking for.