Class kartik\editable\Editable
Inheritance | kartik\editable\Editable » kartik\base\InputWidget » yii\widgets\InputWidget » yii\base\Widget » yii\base\Component » yii\base\BaseObject |
---|---|
Implements | kartik\base\BootstrapInterface, yii\base\Configurable, yii\base\ViewContextInterface |
Uses Traits | kartik\base\BootstrapTrait, kartik\base\TranslationTrait, kartik\base\WidgetTrait |
Available since version | 1.0 |
An extended editable widget for Yii Framework 2.
See also http://github.com/kartik-v/yii2-editable.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$additionalData | array | Additional data to be passed when editable is submitted via ajax request as $key => $value pairs. |
kartik\editable\Editable |
$afterInput | string|Closure | The content to be placed after the rendered input. | kartik\editable\Editable |
$ajaxSettings | boolean | Additional ajax settings to pass to the plugin. | kartik\editable\Editable |
$animationDelay | integer|string | Editable fade animation delay (in micro-seconds). | kartik\editable\Editable |
$asPopover | boolean | Whether to show the editable input as a popover. | kartik\editable\Editable |
$attribute | string|null | The model attribute that this widget is associated with. | yii\widgets\InputWidget |
$autoIdPrefix | string | The prefix to the automatically generated widget IDs. | yii\base\Widget |
$baseSourcePath | string|false | Get parsed base source path based on $sourcePath setting. If $sourcePath is not set, it will return the current working directory of this widget class. | kartik\base\WidgetTrait |
$beforeInput | string|Closure | The content to be placed before the rendered input. | kartik\editable\Editable |
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component. | yii\base\Component |
$bsColCssPrefixes | array | The bootstrap grid column css prefixes mapping, the key is the bootstrap versions, and the value is an array containing the sizes and their corresponding grid column css prefixes. | kartik\base\BootstrapTrait |
$bsCssMap | array | CSS conversion mappings across bootstrap library versions. | kartik\base\BootstrapTrait |
$bsExtBasename | integer | The yii2 bootstrap extension base name (readonly property available via getter method getBsExtBasename()) | kartik\base\BootstrapTrait |
$bsVer | integer | Bootstrap version number currently set (readonly property available via getter method getBsVer()) | kartik\base\BootstrapTrait |
$bsVersion | integer|string | The bootstrap library version that you wish to use for this specific extension / widget. | kartik\base\BootstrapTrait |
$buttonsTemplate | string | The template for rendering the buttons | kartik\editable\Editable |
$closeOnBlur | boolean | Whether to close the editable form when it loses focus. | kartik\editable\Editable |
$containerOptions | array | The HTML attributes for the editable container | kartik\editable\Editable |
$contentOptions | array | The HTML attributes for the container enclosing the main content in the popover dialog. | kartik\editable\Editable |
$convertFormat | boolean | Whether the widget should automatically format the date from the PHP DateTime format to the javascript/jquery plugin format. | kartik\base\InputWidget |
$counter | integer | A counter used to generate $id for widgets. | yii\base\Widget |
$data | array | The data (for list inputs) | kartik\base\InputWidget |
$defaultBtnCss | string | Default bootstrap button CSS (readonly property available via getter method getDefaultBtnCss()) | kartik\base\BootstrapTrait |
$defaultEditableBtnIcon | string | The default icon for editable button set as the label in $editableButtonOptions. | kartik\editable\Editable |
$defaultIconPrefix | string | Default icon prefix (readonly property available via getter method getDefaultIconPrefix()) | kartik\base\BootstrapTrait |
$defaultOptions | array | Default HTML attributes or other settings for widgets. | kartik\base\WidgetTrait |
$defaultPluginOptions | array | Default plugin options for the widget | kartik\base\WidgetTrait |
$defaultPreHeaderIcon | string | The default icon for editable button used in the $preHeader. | kartik\editable\Editable |
$defaultResetBtnIcon | string | The default icon for editable button used in the $preHeader. | kartik\editable\Editable |
$defaultSubmitBtnIcon | string | The default icon for editable button used in the $preHeader. | kartik\editable\Editable |
$disabled | boolean | Whether input is to be disabled | kartik\base\InputWidget |
$displayValue | string | The value to be displayed. | kartik\editable\Editable |
$displayValueConfig | array | The configuration to auto-calculate display value, based on the value of the editable input. | kartik\editable\Editable |
$dropdownClass | string | Bootstrap dropdown class name based on currently configured bootstrap version (readonly property available via getter method getDropdownClass()) | kartik\base\BootstrapTrait |
$editableButtonOptions | array | The HTML attributes for the editable button to be displayed when the format has been set to 'button':
- label : string, the editable button label. |
kartik\editable\Editable |
$editableValueOptions | array | The HTML attributes for the editable value displayed | kartik\editable\Editable |
$encodeOutput | boolean | Whether to HTML encode the output via javascript after editable update. | kartik\editable\Editable |
$field | yii\widgets\ActiveField | Active input field, which triggers this widget rendering. | yii\widgets\InputWidget |
$footer | string | The footer content in the popover dialog or inline panel. | kartik\editable\Editable |
$form | yii\widgets\ActiveForm | kartik\editable\Editable | |
$formClass | array | The class for the ActiveForm widget to be used. | kartik\editable\Editable |
$formOptions | array | The options for the ActiveForm widget class selected in formClass . |
kartik\editable\Editable |
$format | string | The display format for the editable. | kartik\editable\Editable |
$hashVarLoadPosition | integer | The position where the client JS hash variables for the input widget will be loaded. | kartik\base\WidgetTrait |
$header | string | The header content in the popover dialog or inline panel. | kartik\editable\Editable |
$i18n | array | The the internalization configuration for this widget. | kartik\base\TranslationTrait |
$id | string|null | ID of the widget. Note that the type of this property differs in getter and setter. See getId() and setId() for details. | yii\base\Widget |
$inlineSettings | array | The settings for the inline editable when $asPopover is false . |
kartik\editable\Editable |
$inputContainerOptions | array | The HTML attributes for the input container applicable only when not using with ActiveForm | kartik\editable\Editable |
$inputFieldConfig | array | The ActiveField configuration, if you are using with model . |
kartik\editable\Editable |
$inputType | array | The input type to render for the editing the input in the editable form. | kartik\editable\Editable |
$language | string | The language configuration (e.g. 'fr-FR', 'zh-CN'). | kartik\base\InputWidget |
$model | yii\base\Model|null | The data model that this widget is associated with. | yii\widgets\InputWidget |
$moduleId | string | The module identifier if this widget is part of a module. | kartik\base\WidgetTrait |
$name | string|null | The input name. | yii\widgets\InputWidget |
$options | array | The options for the input. | kartik\editable\Editable |
$pjaxContainerId | string | The identifier for the PJAX widget container if the editable widget is to be rendered inside a PJAX container. | kartik\editable\Editable |
$pjaxDuplicationFix | boolean | Prevent duplication of pjax containers when browser back & forward buttons are pressed. | kartik\base\WidgetTrait |
$placement | string | The popover placement. | kartik\editable\Editable |
$pluginDestroyJs | string | The javascript that will be used to destroy the jQuery plugin | kartik\base\WidgetTrait |
$pluginEvents | array | Widget JQuery events. | kartik\base\WidgetTrait |
$pluginLoading | boolean | Show loading indicator while plugin loads | kartik\base\InputWidget |
$pluginName | string | The plugin name | kartik\base\WidgetTrait |
$pluginOptions | array | Widget plugin options. | kartik\base\WidgetTrait |
$preHeader | string | The header content placed before the header text in the popover dialog or inline panel. | kartik\editable\Editable |
$readonly | boolean | Whether input is to be readonly | kartik\base\InputWidget |
$resetButton | array | The HTML attributes for the form reset button. | kartik\editable\Editable |
$resetDelay | integer | Editable reset delay (in micro-seconds). | kartik\editable\Editable |
$selectAllOnEdit | boolean | Whether to select all text in the input when editable is opened. | kartik\editable\Editable |
$showAjaxErrors | boolean | Whether to display any ajax processing errors. | kartik\editable\Editable |
$showButtonLabels | boolean | Whether you want to show the button labels. | kartik\editable\Editable |
$showButtons | boolean | Whether you wish to automatically display the form submit and reset buttons. | kartik\editable\Editable |
$size | string | The size of the popover window. | kartik\editable\Editable |
$sourcePath | string | Directory path to the original widget source. | kartik\base\WidgetTrait |
$stack | yii\base\Widget[] | The widgets that are currently being rendered (not ended). | yii\base\Widget |
$submitButton | array | The HTML attributes for the form submit button. | kartik\editable\Editable |
$submitOnEnter | boolean | Whether to auto submit/save the form on pressing ENTER key. | kartik\editable\Editable |
$type | string | The popover contextual type. | kartik\editable\Editable |
$validationDelay | integer | Editable submission validation delay (in micro-seconds). | kartik\editable\Editable |
$value | string | The input value. | yii\widgets\InputWidget |
$valueIfNull | string | The value to display if the displayValue is null. | kartik\editable\Editable |
$view | yii\web\View | The view object that can be used to render views or view files. Note that the type of this property differs in getter and setter. See getView() and setView() for details. | yii\base\Widget |
$viewPath | string | The directory containing the view files for this widget. | yii\base\Widget |
$widgetClass | string | Any custom widget class to use. | kartik\editable\Editable |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$_bsVer | integer | Current bootstrap version number | kartik\base\BootstrapTrait |
$_dataVar | string | The HTML5 data variable name that will be used to store the Json encoded pluginOptions within the element on which the jQuery plugin will be initialized. | kartik\base\WidgetTrait |
$_defaultBtnCss | string | Default bootstrap button CSS | kartik\base\BootstrapTrait |
$_defaultIconPrefix | string | Default icon CSS prefix | kartik\base\BootstrapTrait |
$_encOptions | string | The JSON encoded plugin options. | kartik\base\WidgetTrait |
$_form | yii\widgets\ActiveForm | Active form instance | kartik\editable\Editable |
$_hashVar | string | The generated hashed variable name that will store the JSON encoded pluginOptions in yii\web\View::POS_HEAD. | kartik\base\WidgetTrait |
$_icons | array | Configuration of icons for BS3 and BS4 | kartik\editable\Editable |
$_inputOptions | array | The HTML attributes or options for the input/widget | kartik\editable\Editable |
$_isBs4 | boolean | Flag to detect whether bootstrap 4. | kartik\base\BootstrapTrait |
$_lang | string | The two or three letter lowercase code for the language according to ISO-639. | kartik\base\InputWidget |
$_langFile | string | The language js file. | kartik\base\InputWidget |
$_loadIndicator | string | The indicator to be displayed while plugin is loading. | kartik\base\InputWidget |
$_msgCat | string | The i18n message category | kartik\editable\Editable |
$_popoverOptions | array | The generated configuration for the kartik\popover\PopoverX widget. | kartik\editable\Editable |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\Component |
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
__construct() | Constructor. | yii\base\BaseObject |
__get() | Returns the value of a component property. | yii\base\Component |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\Component |
__set() | Sets the value of a component property. | yii\base\Component |
__unset() | Sets a component property to be null. | yii\base\Component |
addCssClass() | Adds bootstrap CSS class to options by parsing the bootstrap version for the specified Bootstrap CSS type. | kartik\base\BootstrapTrait |
afterRun() | This method is invoked right after a widget is executed. | yii\base\Widget |
attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
beforeRun() | This method is invoked right before the widget is executed. | yii\base\Widget |
begin() | Begins a widget. | yii\base\Widget |
behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
className() | Returns the fully qualified name of this class. | yii\base\BaseObject |
detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
end() | Ends a widget. | yii\base\Widget |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
getBSClass() | Gets the respective Bootstrap class based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
getBaseSourcePath() | Get parsed base source path based on $sourcePath setting. If $sourcePath is not set, it will return the current working directory of this widget class. | kartik\base\WidgetTrait |
getBehavior() | Returns the named behavior object. | yii\base\Component |
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
getBsVer() | Gets the current set bootstrap version number. | kartik\base\BootstrapTrait |
getCssClass() | Gets bootstrap css class by parsing the bootstrap version for the specified BS CSS type. | kartik\base\BootstrapTrait |
getDefaultBtnCss() | Gets the default button CSS | kartik\base\BootstrapTrait |
getDefaultIconPrefix() | Gets the default icon css prefix | kartik\base\BootstrapTrait |
getDropdownClass() | Gets the respective bootstrap dropdown class name based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
getForm() | Gets the form instance for use at runtime | kartik\editable\Editable |
getId() | Returns the ID of the widget. | yii\base\Widget |
getView() | kartik\base\WidgetTrait | |
getViewPath() | Returns the directory containing the view files for this widget. | yii\base\Widget |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
init() | Initializes the widget. | kartik\editable\Editable |
initI18N() | Yii i18n messages configuration for generating translations | kartik\base\TranslationTrait |
isBs() | Validate Bootstrap version | kartik\base\BootstrapTrait |
isBs4() | Validate if Bootstrap 4.x version. | kartik\base\BootstrapTrait |
off() | Detaches an existing event handler from this component. | yii\base\Component |
on() | Attaches an event handler to an event. | yii\base\Component |
registerAssets() | Registers the client assets for kartik\editable\Editable widget. | kartik\editable\Editable |
registerWidgetJs() | Registers a JS code block for the widget. | kartik\base\WidgetTrait |
removeCssClass() | Removes bootstrap CSS class from options by parsing the bootstrap version for the specified Bootstrap CSS type. | kartik\base\BootstrapTrait |
render() | Renders a view. | yii\base\Widget |
renderFile() | Renders a view file. | yii\base\Widget |
run() | Executes the widget. | kartik\editable\Editable |
setId() | Sets the ID of the widget. | yii\base\Widget |
setView() | Sets the view object to be used by this widget. | yii\base\Widget |
trigger() | Triggers an event. | yii\base\Component |
widget() | Creates a widget instance and runs it. | yii\base\Widget |
Protected Methods
Method | Description | Defined By |
---|---|---|
addAsset() | Adds an asset to the view. | kartik\base\WidgetTrait |
configureBsVersion() | Configures the bootstrap version settings | kartik\base\BootstrapTrait |
convertDateFormat() | Automatically convert the date format from PHP DateTime to Javascript DateTime format | kartik\base\InputWidget |
fixPjaxDuplication() | Fix for weird PJAX container duplication behavior on pressing browser back and forward buttons. | kartik\base\WidgetTrait |
getBsExtBasename() | The yii2-bootstrap extension base name. | kartik\base\BootstrapTrait |
getField() | Gets the active field instance for the configured editable input | kartik\editable\Editable |
getInput() | Generates an input. | kartik\base\InputWidget |
getOutput() | Generates the widget output markup | kartik\editable\Editable |
getPluginScript() | Returns the plugin registration script. | kartik\base\WidgetTrait |
hasModel() | yii\widgets\InputWidget | |
hashPluginOptions() | Generates a hashed variable to store the pluginOptions. | kartik\base\WidgetTrait |
initBsVersion() | Initializes bootstrap versions for the widgets and asset bundles. | kartik\base\BootstrapTrait |
initDestroyJs() | Generates the pluginDestroyJs script if it is not set. |
kartik\base\WidgetTrait |
initDisability() | Validates and sets disabled or readonly inputs. | kartik\base\InputWidget |
initEditable() | Initializes the widget | kartik\editable\Editable |
initIcons() | Initialize default icons | kartik\editable\Editable |
initInlineOptions() | Initializes the inline settings & options. | kartik\editable\Editable |
initInputWidget() | Initializes the input widget. | kartik\base\InputWidget |
initLanguage() | Initialize the plugin language. | kartik\base\InputWidget |
initOptions() | Initializes the widget options. This method sets the default values for various widget options. | kartik\editable\Editable |
isSameVersion() | Compares two versions and checks if they are of the same major BS version. | kartik\base\BootstrapTrait |
mergeDefaultOptions() | Merge default options | kartik\base\WidgetTrait |
parseDateFormat() | Parses and sets plugin date format based on attribute type using yii\helpers\FormatConverter. Currently this method is used only within the kartik\date\DatePicker and \kartik\datetime\DateTimePicker\ widgets. | kartik\base\InputWidget |
parseTemplate() | Parses the inline template and returns the generated content | kartik\editable\Editable |
parseVer() | Parses and returns the major BS version | kartik\base\BootstrapTrait |
registerPlugin() | Registers a specific plugin and the related events | kartik\base\WidgetTrait |
registerPluginOptions() | Registers plugin options by storing within a uniquely generated javascript variable. | kartik\base\WidgetTrait |
renderActionButtons() | Generates the editable action buttons | kartik\editable\Editable |
renderFooter() | Generates the popover footer | kartik\editable\Editable |
renderFormFields() | Renders the editable form fields | kartik\editable\Editable |
renderHtml5Input() | Renders the HTML 5 input | kartik\editable\Editable |
renderInput() | Renders all native HTML inputs (except INPUT_HTML5) | kartik\editable\Editable |
renderInputHtml() | Render a HTML input tag. | yii\widgets\InputWidget |
renderToggleButton() | Renders the toggle button | kartik\editable\Editable |
renderWidget() | Renders a widget | kartik\editable\Editable |
runEditable() | Runs the editable widget | kartik\editable\Editable |
setDataVar() | Sets a HTML5 data variable. | kartik\base\WidgetTrait |
setLanguage() | Sets the language JS file if it exists. | kartik\base\InputWidget |
Events
Event | Type | Description | Defined By |
---|---|---|---|
EVENT_AFTER_RUN | yii\base\WidgetEvent | An event raised right after executing a widget. (available since version 2.0.11) | yii\base\Widget |
EVENT_BEFORE_RUN | yii\base\WidgetEvent | An event raised right before executing a widget. (available since version 2.0.11) | yii\base\Widget |
EVENT_INIT | yii\base\Event | An event that is triggered when the widget is initialized via init(). (available since version 2.0.11) | yii\base\Widget |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
CSS_PARENT | "kv-editable-parent form-group" | CSS setting for the editable parent | kartik\editable\Editable |
FORMAT_BUTTON | 'button' | Editable BUTTON display format | kartik\editable\Editable |
FORMAT_LINK | 'link' | Editable LINK display format (default) | kartik\editable\Editable |
INLINE_AFTER_1 | Editable prebuilt inline template number 1 for content after | kartik\editable\Editable | |
INLINE_AFTER_2 | Editable prebuilt inline template number 2 for content after | kartik\editable\Editable | |
INLINE_BEFORE_1 | kartik\editable\Editable | ||
INLINE_BEFORE_2 | Editable prebuilt inline template number 2 for content before | kartik\editable\Editable | |
INPUT_CHECKBOX | 'checkbox' | Checkbox input | kartik\editable\Editable |
INPUT_CHECKBOX_BUTTON_GROUP | 'checkboxButtonGroup' | Bootstrap styled checkbox button group | kartik\editable\Editable |
INPUT_CHECKBOX_LIST | 'checkboxList' | Checkbox inputs as a list allowing multiple selection | kartik\editable\Editable |
INPUT_CHECKBOX_X | '\kartik\checkbox\CheckboxX' | Krajee checkbox extended input widget kartik\checkbox\CheckboxX | kartik\editable\Editable |
INPUT_COLOR | '\kartik\color\ColorInput' | Krajee color input widget kartik\color\ColorInput | kartik\editable\Editable |
INPUT_DATE | '\kartik\date\DatePicker' | Krajee date picker input widget kartik\date\DatePicker | kartik\editable\Editable |
INPUT_DATETIME | '\kartik\datetime\DateTimePicker' | Krajee date time Picker input widget kartik\datetime\DateTimePicker | kartik\editable\Editable |
INPUT_DATE_RANGE | '\kartik\daterange\DateRangePicker' | Krajee date range picker input widget kartik\daterange\DateRangePicker | kartik\editable\Editable |
INPUT_DEPDROP | '\kartik\depdrop\DepDrop' | Krajee dependent dropdown input widget kartik\depdrop\DepDrop | kartik\editable\Editable |
INPUT_DROPDOWN_LIST | 'dropDownList' | Dropdown list allowing single select | kartik\editable\Editable |
INPUT_FILE | 'fileInput' | File input | kartik\editable\Editable |
INPUT_FILEINPUT | '\kartik\file\FileInput' | Krajee file input widget kartik\file\FileInput | kartik\editable\Editable |
INPUT_HIDDEN | 'hiddenInput' | Hidden input | kartik\editable\Editable |
INPUT_HTML5 | 'input' | Other HTML5 input (e.g. color, range, email etc.) | kartik\editable\Editable |
INPUT_LIST_BOX | 'listBox' | List box allowing multiple select | kartik\editable\Editable |
INPUT_MONEY | '\kartik\money\MaskMoney' | Krajee mask money input widget kartik\money\MaskMoney | kartik\editable\Editable |
INPUT_MULTISELECT | 'multiselect' | Krajee styled multiselect input that allows formatted checkbox list and radio list | kartik\editable\Editable |
INPUT_PASSWORD | 'passwordInput' | Password input | kartik\editable\Editable |
INPUT_RADIO | 'radio' | Radio input | kartik\editable\Editable |
INPUT_RADIO_BUTTON_GROUP | 'radioButtonGroup' | Bootstrap styled radio button group | kartik\editable\Editable |
INPUT_RADIO_LIST | 'radioList' | Radio inputs as a list | kartik\editable\Editable |
INPUT_RANGE | '\kartik\range\RangeInput' | Krajee range input widget kartik\range\RangeInput | kartik\editable\Editable |
INPUT_RATING | '\kartik\rating\StarRating' | Krajee star rating input widget kartik\rating\StarRating | kartik\editable\Editable |
INPUT_SELECT2 | '\kartik\select2\Select2' | Krajee select2 input widget kartik\select2\Select2 | kartik\editable\Editable |
INPUT_SLIDER | '\kartik\slider\Slider' | Krajee slider input widget kartik\slider\Slider | kartik\editable\Editable |
INPUT_SORTABLE | '\kartik\sortinput\SortableInput' | Krajee sortable input widget kartik\sortinput\SortableInput | kartik\editable\Editable |
INPUT_SPIN | '\kartik\touchspin\TouchSpin' | Krajee touch spin input widget kartik\touchspin\TouchSpin | kartik\editable\Editable |
INPUT_SWITCH | '\kartik\switchinput\SwitchInput' | Krajee switch input widget kartik\switchinput\SwitchInput | kartik\editable\Editable |
INPUT_TEXT | 'textInput' | Text input | kartik\editable\Editable |
INPUT_TEXTAREA | 'textArea' | Text area | kartik\editable\Editable |
INPUT_TIME | '\kartik\time\TimePicker' | Krajee Time picker input widget kartik\time\TimePicker | kartik\editable\Editable |
INPUT_TYPEAHEAD | '\kartik\typeahead\Typeahead' | Krajee typeahead input widget kartik\typeahead\Typeahead | kartik\editable\Editable |
INPUT_WIDGET | 'widget' | Input widget | kartik\editable\Editable |
LOAD_INDICATOR | ' | 'Loading indicator markup for the editable | kartik\editable\Editable |
LOAD_PROGRESS | ' |
kartik\base\InputWidget |
Property Details
Active form instance
Configuration of icons for BS3 and BS4
'defaultEditableBtnIcon' => ['pencil', 'pencil-alt'], 'defaultSubmitBtnIcon' => ['ok', 'check'], 'defaultResetBtnIcon' => ['ban-circle', 'ban'], 'defaultPreHeaderIcon' => ['edit', 'edit']
]
The HTML attributes or options for the input/widget
The i18n message category
The generated configuration for the kartik\popover\PopoverX widget.
Additional data to be passed when editable is submitted via ajax request as $key => $value
pairs.
This will generate hidden inputs in the editable form with input name as $key
and input value as $value
.
The content to be placed after the rendered input. If not set as a string, this can be
passed as a callback function of the following signature:
function ($form, $widget) {
// echo $form->field($widget->model, 'attrib');
}
where:
$form
: ActiveForm, is the active form instance for the editable form$widget
: Editable, is the current editable widget instance
Additional ajax settings to pass to the plugin.
See also http://api.jquery.com/jquery.
Editable fade animation delay (in micro-seconds). If entered as a string, it can be one of
'slow'
or 'fast'
.
See also http://api.jquery.com/fadein/.
Whether to show the editable input as a popover. Defaults to true
. If set to false
, it will be
rendered inline.
The content to be placed before the rendered input. If not set as a string, this can be passed as a callback function of the following signature:
function ($form, $widget) {
// echo $form->field($widget->model, 'attrib');
}
where:
$form
: ActiveForm, is the active form instance for the editable form$widget
: Editable, is the current editable widget instance
The template for rendering the buttons
Whether to close the editable form when it loses focus.
The HTML attributes for the editable container
The HTML attributes for the container enclosing the main content in the popover dialog.
The default icon for editable button set as the label in $editableButtonOptions. Defaults to
<i class="glyphicon glyphicon-pencil"></i> for [[bsVersion]] = '3.x' and
for $bsVersion = '4.x'
The default icon for editable button used in the $preHeader. Defaults to:
<i class="glyphicon glyphicon-edit"></i>
for $bsVersion = '3.x' and
<i class="fas fa-edit"></i> Edit
for $bsVersion = '4.x'
The default icon for editable button used in the $preHeader. Defaults to:
<i class="glyphicon glyphicon-ban-circle"></i>
for $bsVersion = '3.x' and
<i class="fas fa-ban"></i>
for $bsVersion = '4.x'
The default icon for editable button used in the $preHeader. Defaults to:
<i class="glyphicon glyphicon-ok"></i>
for $bsVersion = '3.x' and
<i class="fas fa-check"></i>
for $bsVersion = '4.x'
The value to be displayed. If not set, this will default to the attribute value. If the attribute value is null, then this will display the value as set in $valueIfNull.
The configuration to auto-calculate display value, based on the value of the editable input. This
should be a single dimensional array whose keys must match the input value, and the array values must be the
description to be displayed. For example, to display user friendly bool values, you could configure this as
[0 => 'Inactive', 1 => 'Active']
. If this is set, it will override any value set in displayValue
.
The HTML attributes for the editable button to be displayed when the format has been set to 'button':
label
: string, the editable button label. This is not HTML encoded. Defaults to $defaultEditableBtnIcon.
The HTML attributes for the editable value displayed
Whether to HTML encode the output via javascript after editable update. Defaults to true
. Note that
this is only applied, if you do not return an output value via your AJAX response action. If you return an
output value via AJAX it will not be HTML encoded.
The footer content in the popover dialog or inline panel. The following special tags/variables will be parsed and replaced in the footer:
{loading}
: string, will be replaced with the loading indicator.{buttons}
: string, will be replaced with the submit and reset button. If this is set to null or an empty string, it will not be displayed.
The class for the ActiveForm widget to be used. The class must extend from \yii\widgets\ActiveForm
.
This defaults to \kartik\form\ActiveForm
.
The options for the ActiveForm widget class selected in formClass
.
The display format for the editable. Accepts one of the following values.
- `'link' or kartik\editable\Editable::FORMAT_LINK: will convert the text to a clickable editable link.
- `'button' or kartik\editable\Editable::FORMAT_BUTTON: will display a separate button beside the text. Defaults to kartik\editable\Editable::FORMAT_LINK if you do not set it as kartik\editable\Editable::FORMAT_BUTTON.
The header content in the popover dialog or inline panel. If not set, this will be auto generated based on the attribute label or set to null.
The settings for the inline editable when $asPopover is false
. The following properties are
recognized:
options
: array, the HTML attributes for thediv
panel container that will enclose the inline content. By default the options will be set to['class' => 'card panel panel-default']
.closeButton
: string, the markup for rendering the close button to close the inline panel. Note the markup must have the CSS classkv-editable-close
to trigger the closure of the inline panel. ThecloseButton
defaults to<button class="kv-editable-close close">×</button>
.templateBefore
: string, the template for inline content rendered before the input. Defaults to INLINE_BEFORE_1.templateAfter
: string, he template for inline content rendered after the input. Defaults to INLINE_AFTER_1. The following tokens in the templates above will be automatically replaced:- '{header}': the header generated via
preHeader
andheader
properties. - '{inputs}': the main form input content (combining
beforeInput
, the input/widget generated based oninputType
, andafterInput
) - '{buttons}': the form action buttons (submit and reset).
- '{loading}': the loading indicator.
- '{close}': the close button to close the inline content as set in
inlineSettings['closeButton']
.
- '{header}': the header generated via
The HTML attributes for the input container applicable only when not using with ActiveForm
The ActiveField configuration, if you are using with model
.
The input type to render for the editing the input in the editable form. This must be one of the
Editable::TYPE
constants.
The options for the input. If the inputType is one of the HTML inputs, this will capture the HTML
attributes. If the inputType
is set to INPUT_WIDGET or set to an input widget from the \kartik\
namespace, then this will capture the widget options.
The identifier for the PJAX widget container if the editable widget is to be rendered inside a PJAX container. This will ensure the PopoverX plugin is initialized correctly after a PJAX request is completed. If this is not set, no re-initialization will be done for pjax.
The popover placement. Must be one of the PopoverX::ALIGN
constants Defaults to
kartik\popover\PopoverX::ALIGN_RIGHT or right
. This will be applied only if $asPopover is true
.
The header content placed before the header text in the popover dialog or inline panel. This defaults to: '{icon} Edit' - where {icon} is the $defaultPreHeaderIcon markup.
The HTML attributes for the form reset button. The following special properties are additionally recognized:
icon
: string, the icon for the button. Defaults to $defaultResetBtnIconlabel
: string, the label of the button. This is HTML encoded. Defaults toReset
and is translated via yii i18n message files.
Editable reset delay (in micro-seconds).
Whether to select all text in the input when editable is opened.
Whether to display any ajax processing errors. Defaults to true
.
Whether you want to show the button labels. Defaults to false
.
Whether you wish to automatically display the form submit and reset buttons. Defaults to true
.
The size of the popover window. One of the PopoverX::SIZE
constants. This will be applied only
if $asPopover is true
.
The HTML attributes for the form submit button. The following special properties are additionally recognized:
icon
: string, the icon for the button. Defaults to $defaultSubmitBtnIcon.label
: string, the label of the button. This is HTML encoded. Defaults toApply
and is translated via yii i18n message files.
Whether to auto submit/save the form on pressing ENTER key.
The popover contextual type. Must be one of the PopoverX::TYPE constants Defaults to
kartik\popover\PopoverX::TYPE_DEFAULT or default
. This will be applied only if $asPopover is true
.
Editable submission validation delay (in micro-seconds).
The value to display if the displayValue is null. Defaults to '(not set)'.
Any custom widget class to use. Will only be used if the inputType
is set to
INPUT_WIDGET
Method Details
Gets the active field instance for the configured editable input
protected yii\widgets\ActiveField getField ( $label = false ) | ||
$label | boolean|string | The label for the field |
Gets the form instance for use at runtime
public yii\widgets\ActiveForm getForm ( ) |
Generates the widget output markup
protected string getOutput ( $content ) | ||
$content | string | The content to render |
Initializes the widget.
If you override this method, make sure you call the parent implementation first.
public void init ( ) | ||
throws | yii\base\InvalidConfigException | |
---|---|---|
throws | ReflectionException |
Initializes the widget
protected void initEditable ( ) |
Initialize default icons
protected void initIcons ( ) | ||
throws | \yii\base\InvalidConfigException|\Exception |
---|
Initializes the inline settings & options.
protected void initInlineOptions ( ) |
Initializes the widget options. This method sets the default values for various widget options.
protected void initOptions ( ) | ||
throws | yii\base\InvalidConfigException |
---|
Parses the inline template and returns the generated content
protected string parseTemplate ( $template ) | ||
$template | string | The template setting |
Registers the client assets for kartik\editable\Editable widget.
public void registerAssets ( ) |
Generates the editable action buttons
protected string renderActionButtons ( ) |
Generates the popover footer
protected string renderFooter ( ) |
Renders the editable form fields
protected void renderFormFields ( ) |
Renders the HTML 5 input
protected string renderHtml5Input ( ) |
Renders all native HTML inputs (except INPUT_HTML5)
protected string renderInput ( ) |
Renders the toggle button
protected string renderToggleButton ( ) |
Renders a widget
protected string renderWidget ( $class ) | ||
$class | string | The input widget class name |
throws | Exception |
---|
Executes the widget.
public string|void run ( ) | ||
return | string|void | The rendering result may be directly "echoed" or returned as a string |
---|
Runs the editable widget
protected void runEditable ( ) |