16 if (! isset($placeholder) && $type ===
"text")
17 $placeholder = $label;
25 $field = $field->getDataField();
54 $action->asIcon($buttonIcon);
57 $action->onClick(
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'(_,attr)=>(attr=="text")?"password":"text"',
'toggle'));
61 $action->addEvent(
'mousedown',
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"text"',
'add'));
62 $action->addEvent(
'mouseup',
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"password"',
'remove'));
63 $action->addEvent(
'mouseout',
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"password"',
'remove'));
66 $action->onClick(
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"text"',
'add') .
'setTimeout(function(){ ' . $this->
getJsToggle($slashIcon,
'"password"',
'remove') .
' }, 5000);');
72 private function getJsToggle($slashIcon, $type, $actionClass) {
73 return 'th.find(".icon").' . $actionClass .
'Class("' . $slashIcon .
'");th.closest(".field").find("input").attr("type",' . $type .
');';