In case you've missed it, you are looking at an older version of the website. Checkout our latest version, we promise you will love it 😍

set_subject

void set_subject( string $subject )
Quick Description: Set a subject to understand what type of CRUD you use.

This method is really useful when you want to specify what is the actual subject of your table CRUD. The default value is "record" 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 "Office" it will be:

  • instead of "New record" we will have "New Office"
  • instead of "Edit record" we will have "Edit Office"
  • instead of "Are you sure that you want to remove this record?" we will have "Are you sure that you want to remove this "Office"
  • and so on...

Below we can see a live example of how to use it:

function offices_management()
{
        $crud = new grocery_CRUD();
 
        $crud->set_table('offices');
        $crud->set_theme('datatables');
        $crud->required_fields('city');
        $crud->columns('city','country','phone','addressLine1','postalCode');
 
        $crud->set_subject('Office');
 
        $output = $crud->render();
 
        $this->_example_output($output);
}
Note: The below example is an iframe so it might appeared with a scroll bar. If you like you can view the example on a new tab