I made the function to enter text information to the item on the form. Using callback_ (callback_edit_field,
callback_add_field) is not applicable.
I made functions for add text before, after input field and description for field.
to file application/libraries/grocery_crud.php
to class grocery_CRUD_Field_Types
- to function get_field_types() (about 55 line)
after
$field_info->display_as = ....
add text
$field_info->extra_output_before = isset($this->extra_output_before[$field_info->name]) ? $this->extra_output_before[$field_info->name] : null; $field_info->extra_output_after = isset($this->extra_output_after[$field_info->name]) ? this->extra_output_after[$field_info->name] : null; $field_info->extra_output_description = isset($this->extra_output_description[$field_info->name]) ? $this->extra_output_description[$field_info->name] : null;
to class grocery_CRUD extends grocery_CRUD_States
- to the description of the variables (about 3050 line)
after
protected $primary_keys = array();
add text
protected $extra_output_before = array(); protected $extra_output_after = array(); protected $extra_output_description = array();
- between functions (about 3450 line)
after
function display_as($field_name, $display_as = null)
add text
/**
*
* The text before input the field
* @param $field_name
* @param $extra_output_before
* @return void
*/
public function extra_output_before($field_name, $extra_output_before = null)
{
if(is_array($field_name))
{
foreach($field_name as $field => $extra_output_before)
{
$this->extra_output_before[$field] = $extra_output_before;
}
}
elseif($extra_output_before !== null)
{
$this->extra_output_before[$field_name] = $extra_output_before;
}
return $this;
}//extra_output_before
/**
*
* The text after input the field
* @param $field_name
* @param $extra_output_after
* @return void
*/
public function extra_output_after($field_name, $extra_output_after = null)
{
if(is_array($field_name))
{
foreach($field_name as $field => $extra_output_after)
{
$this->extra_output_after[$field] = $extra_output_after;
}
}
elseif($extra_output_after !== null)
{
$this->extra_output_after[$field_name] = $extra_output_after;
}
return $this;
}// extra_output_after
/**
*
* The text after input the field like description
* @param $field_name
* @param $extra_output_description
* @return void
*/
public function extra_output_description($field_name, $extra_output_description = null)
{
if(is_array($field_name))
{
foreach($field_name as $field => $extra_output_description)
{
$this->extra_output_description[$field] = $extra_output_description;
}
}
elseif($extra_output_description !== null)
{
$this->extra_output_description[$field_name] = $extra_output_description;
}
return $this;
}// extra_output_description
to file assets/grocery_crud/themes/flexigrid/add.php
and to file assets/grocery_crud/themes/flexigrid/views/edit.php
after (okolo 30)
<div class='form-input-box' id="<?php echo $field->field_name;?>_input_box">
rewrite
<?php echo $input_fields[$field->field_name]->input?>
on
<?php echo (isset($input_fields[$field->field_name]->extra_output_before))? '<span class="extra_output_before">'.$input_fields[$field->field_name]->extra_output_before.'</span>' : ''; echo $input_fields[$field->field_name]->input; echo (isset($input_fields[$field->field_name]->extra_output_after))? '<span class="extra_output_after">'.$input_fields[$field->field_name]->extra_output_after.'</span>' : ''; echo (isset($input_fields[$field->field_name]->extra_output_description))? '<br/><small class="extra_output_description">'.$input_fields[$field->field_name]->extra_output_description.'</small>' : ''; ?>
it is still to be added
to file assets/grocery_crud/themes/flexigrid/css/flexigrid.css
add text
.extra_output_before {} .extra_output_after {} .extra_output_description { display: block; background-color: #ECECEC; padding: 5px; }
and set the style of drawing text
the same in files assets/grocery_crud/themes/datatables/... to
Using this functions
$this->grocery_crud ->extra_output_before('name', 'TEST text before'); $this->grocery_crud ->extra_output_after('name', 'TEST text after'); $this->grocery_crud ->extra_output_description('name', 'TEST text description');
or
$this->grocery_crud ->extra_output_description('name', 'TEST text description for name') ->extra_output_description('home', 'TEST text description for home');
or
$this->grocery_crud ->extra_output_before('name', 'TEST text before') ->extra_output_after('name', 'TEST text after') ->extra_output_description('name', 'TEST text description');