\Dewdrop\FieldsEditHelperDetector

This class detects the appropriate view helper for editing a \Dewdrop\Db\Field object. It will look at the field's type to determine a reasonable default helper, but you can also call the customizeField() method to override the default for a specific field.

Summary

Methods
Properties
Constants
customizeField()
detect()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$customHelpers
N/A

Properties

$customHelpers

$customHelpers : array

An array of custom helper assignments. The keys in the array are the field's control name and the values are the name of the view helper that should be used.

Type

array

Methods

customizeField()

customizeField(mixed  $field, string  $helperName) : \Dewdrop\Fields\EditHelperDetector

Assign a custom view helper for the provided field. If set, the custom helper will be used instead of the default that would otherwise be used.

You can supply the $field parameter as either a \Dewdrop\Db\Field object or a string representing a field's control name.

Parameters

mixed $field
string $helperName

Returns

\Dewdrop\Fields\EditHelperDetector

detect()

detect(\Dewdrop\Fields\Field  $field) : string

Detect which view helper should be used to edit the supplied \Dewdrop\Db\Field. THis is basic logic used to determine a suitable helper:

  1. If a custom helper was assigned by calling customizeField(), use that.
  2. If it is an EAV field, use whatever helper is assigned in the EAV definition.
  3. Otherwise, look at the field's type to determine which helper would be appropriate.
  4. If a suitable helper cannot be determined, throw an exception.

Parameters

\Dewdrop\Fields\Field $field

Throws

\Dewdrop\Exception

Returns

string