{"id":15095714,"url":"https://github.com/siensis/kpacrud","last_synced_at":"2026-03-01T11:31:57.198Z","repository":{"id":62549827,"uuid":"487943191","full_name":"SIENSIS/KpaCrud","owner":"SIENSIS","description":"KpaCrud Library permits to generate automatically CRUD pages from a DB table","archived":false,"fork":false,"pushed_at":"2024-10-21T07:16:53.000Z","size":448,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-14T14:42:34.880Z","etag":null,"topics":["codeigniter-library","codeigniter4","crud","database-management"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SIENSIS.png","metadata":{"files":{"readme":"readme.md","changelog":"changes.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-05-02T18:06:59.000Z","updated_at":"2024-10-21T07:16:56.000Z","dependencies_parsed_at":"2024-03-11T20:24:47.990Z","dependency_job_id":"e1255d21-0d47-45da-978e-f23805763baa","html_url":"https://github.com/SIENSIS/KpaCrud","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIENSIS%2FKpaCrud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIENSIS%2FKpaCrud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIENSIS%2FKpaCrud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIENSIS%2FKpaCrud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SIENSIS","download_url":"https://codeload.github.com/SIENSIS/KpaCrud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228432525,"owners_count":17918887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeigniter-library","codeigniter4","crud","database-management"],"created_at":"2024-09-25T15:41:23.360Z","updated_at":"2026-03-01T11:31:57.167Z","avatar_url":"https://github.com/SIENSIS.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"- [KpaCrud Library](#kpacrud-library)\n- [Install](#install)\n  - [Install with composer](#install-with-composer)\n  - [Install manually](#install-manually)\n- [Publish command](#publish-command)\n- [Constructor](#constructor)\n- [Routes file](#routes-file)\n- [Config file parameters](#config-file-parameters)\n- [Method setConfig](#method-setconfig)\n- [Method setTable](#method-settable)\n- [Method setPrimaryKey](#method-setprimarykey)\n- [Method setColumns](#method-setcolumns)\n- [Method setRelation](#method-setrelation)\n- [Method addWhere](#method-addwhere)\n- [Method limit](#method-limit)\n- [Method setColumnsInfo](#method-setcolumnsinfo)\n  - [Available parameters](#available-parameters)\n  - [Set field name](#set-field-name)\n  - [Field types and samples](#field-types-and-samples)\n    - [Number field type](#number-field-type)\n    - [Range field](#range-field)\n    - [Make a field **required**](#make-a-field-required)\n    - [Make a field **Invisible**](#make-a-field-invisible)\n    - [Checkbox field](#checkbox-field)\n    - [Date field with default value in Add page](#date-field-with-default-value-in-add-page)\n    - [Datetime field with default value in Add page](#datetime-field-with-default-value-in-add-page)\n    - [Password field type](#password-field-type)\n    - [Dropdown field type](#dropdown-field-type)\n- [Method hideHeadLink](#method-hideheadlink)\n- [Method addPostAddCallBack and addPostEditCallBack](#method-addpostaddcallback-and-addposteditcallback)\n- [Functions isViewMode, isExportMode, isAddMode, isEditMode, isDelMode, isTrashMode](#functions-isviewmode-isexportmode-isaddmode-iseditmode-isdelmode-istrashmode)\n- [Method addItemFunction](#method-additemfunction)\n- [Method addItemLink](#method-additemlink)\n- [Library Exceptions](#library-exceptions)\n\n# KpaCrud Library\n\n- [Samples and how to's](samples.md)\n- [Change list](changes.md)\n- [TODO](todo.md)\n  \n# Install \n\n## Install with composer\n\n**Option 1:**\n\nYou need to add `SIENSIS/KpaCrud` require with composer tool.\n\n```dos\n\u003e composer require siensis/kpacrud:dev-master\n```\n\n**Option 2:**\n\nor modify `composer.json` and add the package to require items into `composer.json`\n\n```json\n    \"require\": {\n        \"siensis/kpacrud\": \"dev-master\"\n    },\n```\n**Finally**\n\nExecute `composer update` command to update your project settings\n\n```dos\n\u003e composer update\n```\n\n\u003e :bulb: **Idea**\n\u003e \n\u003e If you have any  problem, probably you need to update you composer, executing:\n\u003e \n\u003e composer self-update --2\n\n## Install manually\n\nDownload KpaCrud project and extract into your project in a ThirdPary folder, with this structure:\n\n\u003e :file_folder: app\n\u003e \n\u003e :file_folder: public\n\u003e \n\u003e :file_folder: tests\n\u003e \n\u003e :file_folder: vendor\n\u003e  \n\u003e :file_folder: ThirdParty\n\u003e \n\u003e |---- :file_folder:  SIENSIS\n\u003e \n\u003e |---- |---:file_folder: KpaCrud\n\n\nThen you need modify autoload config file `app/Config/Autoload.php` and add your new PSR4 package path.\n\n```php\npublic $psr4 = [\n    APP_NAMESPACE =\u003e APPPATH, // For custom app namespace\n    'Config'      =\u003e APPPATH . 'Config',\n    'SIENSIS\\KpaCrud' =\u003e ROOTPATH . 'ThirdParty'.DIRECTORY_SEPARATOR.'SIENSIS'.DIRECTORY_SEPARATOR.'KpaCrud'.DIRECTORY_SEPARATOR.'src'\n];\n```\n\n\u003e :bulb: **Idea**\n\u003e \n\u003e Constant **`DIRECTORY_SEPARATOR`** is used to prevent path problems in Linux or Windows servers\n\u003e \n# Publish command\n\n`KpaCrud` has their command `kpacrud:publish` to generate automatically a sample controller, a view sample, a custom config file and the KpaCrud lang files into your App folder.\n\nTo generate this files, you need to execute this command:\n\n```dos\n\u003e php spark kpacrud:publish\nPublish demo Controller? [y, n]:\nPublish Views? [y, n]:\nPublish Config file? [y, n]:\nPublish Language file? [y, n]:\n```\n\nIf files already exists, publish command ask you for confirmation. Otherwise if you sure to overwrite files, you can call `kpacrud:publish` with `-f` option, like:\n\n```dos\n\u003e php spark kpacrud:publish -f\n```\n\n# Constructor\n\nYou can save all config parameters into `KpaCrud.php` file in `App\\Config` folder. \n\n```php\n$crud = new KpaCrud(); //loads default configuration\n```\nLoads default parameters with `configDefaultName` as the config collection parameters. If you would like to load another collection, you can indicate it in constructor.\n\nWith this sample you KpaCrud library loads `listView` defined parameters.\n```php\n$crud = new KpaCrud('listView'); //loads listView configuration\n```\n# Routes file\n\nKpaCrud library works with GET and POST methods, you need to create a GET and POST route to your controller function.\n\n```php\n$routes-\u003ematch(['get','post'],'/route/to/crud', 'SampleKpaCrudController::demo_function');\n```\nPOST Method is used by KpaCrud in `Add submit`, `Delete confirm` and `Edit submit`.\n\n# Config file parameters\nIn the file `App\\Config\\KpaCrud.php` you can can store parameters collections identified with a name and the collection parameter used as default.\n\n\n| Param name         |  Type   |   Default    | Description                                                                                                                 |\n| ------------------ | :-----: | :----------: | --------------------------------------------------------------------------------------------------------------------------- |\n| editable           | boolean |     true     | Defines if row has edit button                                                                                              |\n| removable          | boolean |     true     | Defines if row has delete button                                                                                            |\n| **Table tools**    |\n| lang               | string  |              | Defines the URL of JS file language for Datatables JQuery tool                                                              |\n| sortable           | boolean |     true     | Defines if table has enabled the sortable feature                                                                           |\n| filterable         | boolean |     true     | Defines if table has enabled the searching tool                                                                             |\n| paging             | boolean |     true     | Defines if table has enabled the paging tools                                                                               |\n| numerate           | boolean |     true     | Defines library numerate rows                                                                                               |\n| **Table features** |\n| pagingType         | string  |              | Determines the paging type, values are: `numbers`, `simple`, `simple_numbers`, `full`, `full_numbers`, `first_last_numbers` |\n| defaultPageSize    |   int   |              | Determines the page size set as default                                                                                     |\n| rememberState      | boolean |    false     | Defines if table remembers last order column, search, etc                                                                   |\n| **Right toolbar**  |\n| add_button         | boolean |     true     | Enables add button in top right toolbar                                                                                     |\n| show_button         | boolean |     true     | Enables show button in list items                                                                                          |\n| recycled_button    | boolean |     true     | Enables trash buttons in top right toolbar (Empty trash, show trash)                                                        |\n| exportXLS          | boolean |     true     | Enables export XLS button in top right toolbar                                                                              |\n| print              | boolean |     true     | Enables print button in top right toolbar                                                                                   |\n| **Left toolbar**   |         |              |\n| multidelete        | boolean |     true     | Enables the multi select feature in table list to remove item or to move to trash if softDelete is enabled                  |\n| deletepermanent    | boolean |     true     | Enables the multi select feature in table list to remove item permanently if softDelete is enabled                          |\n| **Model features** |         |              |\n| useSoftDeletes     | boolean |     true     | Enables the soft delete feature, then items are mark as delete and they can use trash view                                  |\n| showTimestamps     | boolean |    false     | Enables to show fields created_at and updated_at in view page                                                               |\n| createdField       | string  | 'created_at' | Name of created_at field into database                                                                                      |\n| updatedField       | string  | 'updated_at' | Name of update_at field into database                                                                                       |\n| deletedField       | string  | 'deleted_at' | Name of deleted_at field into database                                                                                      |\n\nIn config file you can define the default collection with `configDefaultName`.\n\nThe KpaCrud config file provided, are defined `onlyView`, `listView` and `default` (acts as fullView ).\n\n# Method setConfig\n\nYou can set config parameters after object Library is created. The function setConfig can change all config parameters if you set a collection name as a parameter.\n\n```php\n$crud-\u003esetConfig('onlyView');\n```\neven, you can change only a [parameter](#config-file-parameters), like:\n\n```php\n$crud-\u003esetConfig(['editable'=\u003efalse]);                     // Sets editable configuration to false\n$crud-\u003esetConfig(['editable'=\u003efalse,'removable'=\u003efalse]);  //Sets editable and removable config parameter to false \n```\n\nSee also [How to create your custom App\\KpaCrud config file](samples.md#how-to-create-your-custom-appkpacrud-config-file)\n\n# Method setTable\n\nThis method sets table name to generate CRUD pages, when you set table name, method can detect primary key. By default, `setTable` doesn't detect primary key.\nTo load automatically primary key, you need to set `true` the `loadPrimaryKeys` function flag, like this sample:\n```php\n$crud-\u003esetTable('news', true);    // Primary key autoload feature\n```\n\notherwise, you can only specify table name.\n\n```php\n$crud-\u003esetTable('news');\n```\n\n# Method setPrimaryKey\n\nThis method adds primary key to CRUD Library, you can use it if you doesn't use \nautomatic primary key load. You can call function for every key, if your table has more than\na primary key.\n\n```php\n$crud = new KpaCrud();\n\n$crud-\u003esetTable('tokens');\n$crud-\u003esetPrimaryKey('tokenid');\n$crud-\u003esetPrimaryKey('subject');\n```\n\n\u003e [:warning: Exception](#library-exceptions)\n\u003e \n\u003e If the primary key string field doesn't exists, method will throw an exception\n\n# Method setColumns\n\nThis method will permit to set columns that will be shown in CRUD Page view or CRUD Trash view if enabled. \n\n```php\n$crud = new KpaCrud('listView');        // loads listView configuration\n$crud-\u003esetTable('news');                // load news table\n$crud-\u003esetPrimaryKey('id');             // set primary key to id field\n$crud-\u003esetColumns(['id', 'title', 'data_pub']); // set fields to show in listView\n```\n\n\u003e [:warning: Exception](#library-exceptions)\n\u003e \n\u003e Function throws this \n\u003e - Table is null or not defined\n\u003e - Table doesn't exists in database\n\u003e - Field doesn't exists in table\n# Method setRelation\n\nWith this method you can set a relation 1=\u003eN from a table to another one, for CRUD operations.\n\n```php\n  $crud = new KpaCrud('listView');                          // loads listView configuration    \n \n  $crud-\u003esetTable('auth_groups_users');                     // set table name\n \n  $crud-\u003esetPrimaryKey('group_id');                         // set primary key\n  $crud-\u003esetPrimaryKey('user_id');                          // set primary key\n \n // function setRelation($fieldName, $relatedTable, $relatedField, $display_as = null)\n\n // display_as is the column name to show in edit / view mode\n // if not set, relatedfield is shown\n  $crud-\u003esetRelation('group_id', 'auth_groups', 'id', 'name');\n  $crud-\u003esetRelation('user_id', 'users', 'id', 'username');\n```\nThe display_as parameter is to indicated the field name from related table, to show instead relatedField. If parameter is null, will show first upper case related field name\n\nThey can display more than a relation, like example.\n# Method addWhere  \n\nThis method permits to filter data show in the KpaCrud admin table. You can \nset filter as an associative array, or you can set SQL where expression as string. \n\nThe third parameter permits you to use OR conjuntion in a where clause\n\n```php\n    $crud-\u003eaddWhere (\"id\",\"3\");\n    $curd-\u003eaddWhere (\"id\",\"4\", true);\n```\nThis clause generates \n```sql\nWHERE id=3 OR id=4\n```\n\n\u003e:warning: **WARNING!!**\n\u003e\n\u003eIf you use parameters with this function, you need to check it to avoid SQL injection\n# Method limit  \nThis method adds limit clause to database query, usefull to show limited data. Sintax as codeigniter querybuilder limit function\n```php\n  $crud-\u003elimit(10);   // Produces: LIMIT 10\n\n  $crud-\u003elimit(10, 20);  // Produces: LIMIT 20, 10\n```\n\n# Method orderBy  \nThis method Adds order by clause to database query, usefull to show ordered data. Sintax as codeigniter querybuilder limit function\n```php\n  $crud-\u003eorderBy('title', 'DESC');  // Produces: ORDER BY `title` DESC\n\n  $crud-\u003eorderBy('title DESC, name ASC');  // Produces: ORDER BY `title` DESC, `name` ASC\n\n  $crud-\u003eorderBy('title', 'DESC');  $builder-\u003eorderBy('name', 'ASC');   // Produces: ORDER BY `title` DESC, `name` ASC\n\n  $crud-\u003eorderBy('title', 'RANDOM');  // Produces: ORDER BY RAND()\n\n  $crud-\u003eorderBy(42, 'RANDOM');  // Produces: ORDER BY RAND(42)\n```\n\n# Method setColumnsInfo\n\n## Available parameters\n\nThe function setColumnsInfo permits to customize every database field.\n\n\n| Parameter     |         Type          | Description                                                                                                                                                                                                                                                |\n| ------------- | :-------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| name          |       `string`        | Field name to show user in pages                                                                                                                                                                                                                           |\n| type          |       `string`        | Availables field types are: DEFAULT_FIELD_TYPE, READONLY_FIELD_TYPE, INVISIBLE_FIELD_TYPE, EMAIL_FIELD_TYPE, CHECKBOX_FIELD_TYPE,NUMBER_FIELD_TYPE, RANGE_FIELD_TYPE, DATE_FIELD_TYPE, DATETIME_FIELD_TYPE, TEXTAREA_FIELD_TYPE [(Check field types)](#field-types-and-samples) |\n| default       |       `string`        | Field default value in add page                                                                                                                                                                                                                            |\n| check_value   | `string,bool,integer` | Value stored when a checkbox is checked. __DEFAULT=1__                                                                                                                                                                                                     |\n| uncheck_value | `string,bool,integer` | Value stored when a checkbox is unchecked. __DEFAULT=0__                                                                                                                                                                                                   |\n| html_atts     |    `array[string]`    | Others html attributes to add to field, like: required, placeholder, pattern, title, min, max, step...                                                                                                                                                     |\n| options       |        `array`        | Options to show in a dropdown field                                                                                                                                                                                                                        |\n| excludes      |        `array`        | Values that are excluded to show into field    |\n| nullable | `string` | Set to make a field nullable into DB. Their values serves to check into UI |\n\n## Set field name\n\n\nYou can set the field name with the properties associative array like this sample:\n```php\n'dbfieldname' =\u003e [\n    'name' =\u003e 'Field name to show',\n],\n```\nor you can set it directly, but in this last version, you can only set the name for a db field.\n```php\n'dbfieldname' =\u003e 'Field name to show',\n```\n\n## Field types and samples\n### Number field type\n\n```php\n'dbfieldname' =\u003e [\n    'name' =\u003e 'Demo number field',\n    'type' =\u003e KpaCrud::NUMBER_FIELD_TYPE,\n    'default' =\u003e '25',\n    'html_atts' =\u003e [\n        'min=\"1\"',\n        'max=\"50\"',\n    ]\n],\n```\n\n### Range field\n\n```php\n'dbfieldname' =\u003e [\n    'name' =\u003e 'Demo text field',\n    'type' =\u003e KpaCrud::RANGE_FIELD_TYPE,\n    'default' =\u003e '25',\n    'html_atts' =\u003e [        // html_atts are optional, but useful to costumize page\n        'min=\"1\"',\n        'max=\"50\"',\n        'step=\"5\"',\n    ]\n],\n```\n\n### Make a field **required**\n\n```php\n'dbfieldname' =\u003e [\n    'name' =\u003e 'Demo text field',\n    'html_atts' =\u003e [\n        \"required\", \n        \"placeholder=\\\"Add your info here\\\"\"\n    ],\n],\n```\n\n### Make a field **Invisible**\n\nThis field will be invisible in all views\n\n```php\n'dbfieldname' =\u003e [\n    'type' =\u003e KpaCrud::INVISIBLE_FIELD_TYPE\n],\n```\n### Make a field **READ ONLY** \n\nThis field will be read only in add or edit view\n\n```php\n'dbfieldname' =\u003e [\n    'type' =\u003e KpaCrud::READONLY_FIELD_TYPE\n],\n```\n### Checkbox field\n\n```php\n'dbfieldname' =\u003e [\n    'name' =\u003e 'Demo text field',\n    'type' =\u003e KpaCrud::CHECKBOX_FIELD_TYPE, \n    'check_value' =\u003e '1',   // By default check_value=1. You can omit it is equal\n    'uncheck_value' =\u003e '0'  // By default uncheck_value=0    \n],\n```\n\n\n### Date field with default value in Add page\n\n```php\n'dbfieldtype' =\u003e [\n    'type' =\u003e KpaCrud::DATE_FIELD_TYPE,\n    'default' =\u003e '1-2-2022'  // you can set default date for add page\n],\n```\n\n### Datetime field with default value in Add page\n\n```php\n'dbfieldtype' =\u003e [\n    'type' =\u003e KpaCrud::DATETIME_FIELD_TYPE,\n    'default' =\u003e '1-2-2022 15:43'  // you can set default date for add page\n],\n```\n### Password field type\n\nThis type permits to hide content data in edit page or new page. All fields typed as password are always hidden in view or delete views.\n\nPassword field type in the edit page adds a hidden form field to check programatically if user has changed the value. This feature permits you to combine with edit and new callback to store passwords hashed in you DB.\n\nSee [Samples file](samples.md)\n\n### Dropdown field type\n\nYou can create a custom dropdown item, to control values introduced in a field by user. You can define dropdown values with an associative array. \n\nTo make an identic checkbox with a dropdown, you can set item-value only, like this.\n\u003ctable\u003e\u003ctr\u003e\u003ctd\u003e\u003cpre\u003e\n'active' =\u003e [\n    'type' =\u003e KpaCrud::DROPDOWN_FIELD_TYPE,\n    'options' =\u003e [\"Disabled\", \"Active\"],\n    'html_atts'=\u003e[\n        \"required\",\n    ]\n],\n\u003c/pre\u003e\u003c/td\u003e\u003ctd\u003e\u003cpre\u003e\n'active' =\u003e [\n    'type' =\u003e KpaCrud::DROPDOWN_FIELD_TYPE,\n    'options' =\u003e [\"0\"=\u003e\"Disabled\", \"1\"=\u003e\"Active\"],\n    'html_atts'=\u003e[\n        \"required\",\n    ]\n],\n\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\nThis samples generates\n```html\n\u003cselect name=\"data_active\" id=\"data_active\" required=\"\"\u003e\n    \u003coption value=\"0\"\u003eDisabled\u003c/option\u003e\n    \u003coption value=\"1\"\u003eActive\u003c/option\u003e\n\u003c/select\u003e\n```\n\nIf you need to show a select value item in a dropdown, you can do it easily adding a null index item. Like this sample.\n\n```php\n'active' =\u003e [\n    'type' =\u003e KpaCrud::DROPDOWN_FIELD_TYPE,\n    'options' =\u003e [\"\"=\u003e\"Select option\",\"Disabled\",\"Active\"],\n    'html_atts'=\u003e[\n        \"required\",\n    ]\n],\n```\nThis samples generates\n```html\n\u003cselect name=\"data_active\" id=\"data_active\" required=\"\"\u003e\n    \u003coption value=\"\" selected=\"selected\"\u003eSelect option\u003c/option\u003e\n    \u003coption value=\"0\"\u003eDisabled\u003c/option\u003e\n    \u003coption value=\"1\"\u003eActive\u003c/option\u003e\n\u003c/select\u003e\n```\n# Method hideHeadLink\nIf you need to hide CSS/JS from head, you can use `hideHeadLink` function. Every link has its own id, the availables ones are:\n\n\n| ID                  | Description                            |\n| ------------------- | -------------------------------------- |\n| js-query            | JQuery Javascript CDN                  |\n| js-bootstrap        | Bootstrap JS file                      |\n| js-datatables       | Datatables plugin JS file              |\n| js-datatables-boot  | Datatables JS file for bootstrap theme |\n| css-bootstrap       | Bootstrap CSS file                     |\n| css-datatables-boot | Datatables CSS for bootstrap theme     |\n| css-fontawesome     | Fontawesome CSS file                   |\n\nSee [\"How to change bootstrap, jquery or CSS/JS head links\"](samples.md#how-to-change-bootstrap-jquery-or-cssjs-head-links) for a sample.\n\n# Method addPostAddCallBack and addPostEditCallBack\n\nIf you need to get post data to change anythig before `KpaCrud` uses this info to store it in database, you need to set an add or edit callback. \n\nThe function will receive post data and they must return post data modified or **`null`** if you need to cancel event, in this case `KpaCrud` showns a cancel message like: **` Error callback function cancel operation`**\n\nPost data fields will use the name according this structure: \n\n\u003e data_ + DATABASE_FIELD_NAME\n\nSee [\"How to set a callback to store hashed password\"](samples.md#how-to-set-a-callback-to-store-hashed-password) for a sample.\n\n# Functions isViewMode, isExportMode, isAddMode, isEditMode, isDelMode, isTrashMode\n\nThe functions functions `isViewMode`, `isExportMode`, `isAddMode`, `isEditMode`, `isDelMode`, `isTrashMode` permits you to know KpaCrud mode, to customize KpaCrud aspect.\n\n**Sample**: You need to export all database fields but in list mode you would like to show only id and description fields.\n\nSee \n[\"How to custom parameters according KpaCrud view mode\"](samples.md#how-to-custom-parameters-according-kpacrud-view-mode) for a sample.\n\n# Method addItemFunction\n\nThis function permits to declare a new icon function in every register. The function used as callback may be defined in your controllers.\n\nThe callback function used may returns a view as string. KpaCrud library uses this html information to show them in KpaCrud interface.\n\nIf you need a function to be called afterly, as post page or other like this, you can  define invisible functions.\n\nSee \n[How to add a function for every register](samples.md#how-to-add-a-function-for-every-register) for a sample.\n# Method addItemLink \nThis function permits to declare a new icon link for every register. The function used as callback may be defined in your controllers.\n\n```php\n        $crud-\u003eaddItemLink('view', 'fa-file-o', base_url('route/to/link'), 'Tooltip for icon button');\n        // GENERATES \u003ca href=\"route/to/link/[IDs_SEPARETED_BY_SLASH]\" title=\"HELP TEXT\"\u003eICON\u003c/a\u003e\n\n        $crud-\u003eaddItemLink('show', 'fa-file-o', [base_url('route/to/link'),'hash'], 'Tooltip for icon button'));\n        // GENERATES \u003ca href=\"route/to/link/[IDs_SEPARETED_BY_SLASH_HASHED]\" title=\"HELP TEXT\"\u003eICON\u003c/a\u003e\n        \n        $crud-\u003eaddItemLink('show', 'fa-file-o', [base_url('route/to/link?param='),'hashquery'], 'Tooltip for icon button'));\n        // GENERATES \u003ca href=\"route/to/link?param=ID_HASH\" title=\"HELP TEXT\"\u003eICON\u003c/a\u003e\n\n        $crud-\u003eaddItemLink('show', 'fa-file-o', [base_url('route/to/link?param='),'queryid'], 'Tooltip for icon button'));\n        // GENERATES \u003ca href=\"route/to/link?param=ID\" title=\"HELP TEXT\"\u003eICON\u003c/a\u003e\n```\n# Library Exceptions\n\n\n| Exception ID | Exception                 |                                                                                                   |\n| ------------ | ------------------------- | ------------------------------------------------------------------------------------------------- |\n| 1, 4, 8      | Table name is null        |                                                                                                   |\n| 2, 5, 9      | Table not exists in DB    |                                                                                                   |\n| 3, 6         | Field name not exists     | You try to set a field name as ID or show as a column in list view, and this field doesn't exists |\n| 7            | Field type unknown        | Check available field types in documentation                                                      |\n| 10           | ID Field name set to null |                                                                                                   |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiensis%2Fkpacrud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiensis%2Fkpacrud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiensis%2Fkpacrud/lists"}