Merge pull request #10649 from seamuslee001/CRM-20860
authorEileen McNaughton <eileen@mcnaughty.com>
Mon, 17 Jul 2017 20:15:30 +0000 (08:15 +1200)
committerGitHub <noreply@github.com>
Mon, 17 Jul 2017 20:15:30 +0000 (08:15 +1200)
CRM-20860 Add in ability to create field type of password from metadata

CRM/Core/Form.php
CRM/Core/Form/Renderer.php
css/civicrm.css

index 8fb7be9b9eb0e0e8fd9113519195b4f48bec6238..99a091d64f5fa783ec1e028d8b1c610871b25b58 100644 (file)
@@ -1524,6 +1524,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       case 'EntityRef':
         return $this->addEntityRef($name, $label, $props, $required);
 
+      case 'Password':
+        return $this->add('password', $name, $label, $props, $required);
+
       // Check datatypes of fields
       // case 'Int':
       //case 'Float':
index d67f82b478dd0e2f0209b78d6e40fe49ab244cd3..d1be3d7bcca3050a5386eac1160d05dbfb552178 100644 (file)
@@ -179,7 +179,7 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty {
     $class = $element->getAttribute('class');
     $type = $element->getType();
     if (!$class) {
-      if ($type == 'text') {
+      if ($type == 'text' || $type == 'password') {
         $size = $element->getAttribute('size');
         if (!empty($size)) {
           $class = CRM_Utils_Array::value($size, self::$_sizeMapper);
index 4ae64c863097ee645cbe714ddaf87312dbdab414..e4f2395424b0b4735936a8a41b52f6141de27362 100644 (file)
@@ -271,7 +271,8 @@ input.crm-form-entityref {
 }
 .crm-container input.crm-form-text,
 .crm-container .crm-icon-picker-button,
-.crm-container input.dateplugin {
+.crm-container input.dateplugin,
+.crm-container input.crm-form-password {
   border: 1px solid #999;
   vertical-align: middle;
   padding: 1px 2px;
@@ -285,7 +286,9 @@ input.crm-form-entityref {
 .crm-container input.crm-form-text[disabled],
 .crm-container input.dateplugin[disabled],
 .crm-container select.crm-form-select[disabled],
-.crm-container input.crm-form-text[readonly] {
+.crm-container input.crm-form-text[readonly],
+.crm-container input.crm-form-password[disabled],
+.crm-container input.crm-form-password[readonly] {
   background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #ddd), color-stop(15%, #f2f2f2));
   background-image: -webkit-linear-gradient(top, #ddd 1%, #f2f2f2 15%);
   background-image: -moz-linear-gradient(top, #ddd 1%, #f2f2f2 15%);
@@ -294,7 +297,8 @@ input.crm-form-entityref {
 
 .crm-container input.crm-form-text[disabled],
 .crm-container input.dateplugin[disabled],
-.crm-container select.crm-form-select[disabled] {
+.crm-container select.crm-form-select[disabled],
+.crm-container input.crm-form-password[disabled] {
   color: #a9a9a9;
 }