setSubject(string $subject [, string $subject_plural])

Set a subject title for all the CRUD operations for this object.

This method is really useful when you want to specify what is the actual subject of your table CRUD. Moreover you don't have to add every time all the strings that the user will see as they are very similar. The default value is "Item" and it is also translatable. It is very easy to set a subject and then this string is reused in almost every message or operation.

For example if we insert as a subject the string "Employee" it will be:

A good way to add a subject is to add it as a non plural subject. For example: Employee and not Employees, City and not Cities and so on...

Example usage:

$crud->setSubject('Film', 'Films');

The subject plural is not required so you can also have something like this:


However it is highly recommended to add the plural of your subject as it may be a good indicator in some cases for your end-user.


$crud->setSubject('Customer', 'Customers');

$output = $crud->render();

with a result: