Jump to content


ryan-bb

Member Since 27 Jun 2019
Offline Last Active Jul 08 2019 12:01 PM
-----

#149238 callbackAddField has no information about the field.

Posted ryan-bb on 04 July 2019 - 03:27 PM

Hi Johnny,

 

Thanks for your response. That's great news that your working on the feature already!

 

We're using composer to install GC so I'll wait for the release.

 

Thanks for you hard work




#149222 callbackAddField has no information about the field.

Posted ryan-bb on 27 June 2019 - 11:03 AM

Hi,

 

I am in the process of upgrading my instance of grocery CRUD to the enterprise version and have noticed some missing functionality in the field callbacks which is holding me back.

 

When calling callback_field, you passed through the following parameters ($fieldValue, $primaryKey, $fieldInfo = null, $fieldValues = null). $fieldInfo had important information about the field including name, required etc. that I was using to form a new field.

 

Now in the new enterprise version, I need to call callbackAddField to achieve the same thing. This however, passes no information through about the field and as far as I can tell there is no way to get this information from the $crud instance.

 

Here is an example of one of the fields I am creating for a custom datetime picker (I have stripped out some of the logic to make it clearer) :

public function fieldDatePicker($fieldValue = null, $primaryKeyValue = null, $rowData = null): string
{
    $readOnly = $rowData->crud_type == 'readonly' ? ' readonly' : '';
    $required = $rowData->required ? ' required' : '';

    // More logic stripped out for this example

    return '<input type="text" class="bsdatepicker form-control" autocomplete="off" value="' . $fieldValue . '" name="' . $rowData->name . '"' . $readOnly . $required . '>';
}
$this->crud->callbackAddField($field, [$this->callbacks, 'fieldDatePicker']);

I understand that I can use "function () use ($field) {" to pass additional data through to the callback, however it does not line up with the data already set by Grocery CRUD so seems like a step in the wrong direction.

 

Is there any way to get information about a field to pass through to the callback?

 

Thanks