GitHub

EditorNeo customizations

The functionality of EditorNeo is limited and one of the most fundamental customizations is setting the database. By default, EditorNeo picks the first available database for the logged-in user. To change this, override the getDatabase() method in the adminneo-instance.php file (see Advanced customizations):

<?php

class CustomEditor extends \AdminNeo\Admin
{
    public function getDatabase()
    {
        return "my_database_name";
    }
}

// Use the factory method to create the CustomEditor instance.
return CustomEditor::create();

SQLite

A very similar use case is setting up EditorNeo for use with a SQLite database:

<?php

class CustomEditor extends \AdminNeo\Admin
{
    public function getDatabase()
    {
        return "/path/to/your/database_file.db";
    }

    public function getLoginFormRow($fieldName, $label, $field)
    {
        // Hide username field.
        if ($fieldName == "username") {
            return "";
        }

        return parent::getLoginFormRow($fieldName, $label, $field);
    }
}

$config = [
    "defaultDriver" => "sqlite",
    // Inline the result of password_hash() so that the password is not visible in the source code.
    // password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT)
    "defaultPasswordHash" => '$2y$12$iPiS7CrfImmfjfQU9YU4ZeGNXRu9NiszTPyMik/ZsrRAadlgs8r3G',
];

// Use the factory method to create the CustomEditor instance.
return CustomEditor::create($config);