unsetEditFields

unsetEditFields(array $fields)

There are cases that we have lots of fields and we just need to say "I need all of them expect these 3". Well unsetEditFields is doing just that! This function is really useful especially when the development of the database is on going. The syntax is simple:

$crud->unsetEditFields(['address_1', 'address_2', 'credit_limit']);

You can see a full working example below:

$crud->setTable('customers');
$crud->setSubject('Customer', 'Customers');
$crud->setRead();
$crud->unsetEditFields(['salesRepEmployeeNumber','creditLimit']);

$output = $crud->render();

As you can also see by your own at the below live example, in every area all the fields/columns are visible expect the ones at the edit form modal. More specifically you will notice that the fields "salesRepEmployeeNumber" and "creditLimit" are missing when you press "Edit Customer" in any row: