Merge pull request #5078 from eileenmcnaughton/comment-full-stops
[civicrm-core.git] / CRM / Core / Form.php
index 7d868d19160703b55ca842467426416404bd9951..1ecbbede88734d9c028a39123c08580e2f606b53 100644 (file)
@@ -152,7 +152,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   private $_chainSelectFields = array();
 
   /**
-   * Constructor for the basic form page
+   * Constructor for the basic form page.
    *
    * We should not use QuickForm directly. This class provides a lot
    * of default convenient functions, rules and buttons
@@ -361,7 +361,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   }
 
   /**
-   * The postProcess hook is typically called by the framework
+   * The postProcess hook is typically called by the framework.
    * However in a few cases, the form exits or redirects early in which
    * case it needs to call this function so other modules can do the needful
    * Calling this function directly should be avoided if possible. In general a
@@ -502,10 +502,11 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   /**
    * Add default Next / Back buttons
    *
-   * @param array array of associative arrays in the order in which the buttons should be
-   *                displayed. The associate array has 3 fields: 'type', 'name' and 'isDefault'
-   *                The base form class will define a bunch of static arrays for commonly used
-   *                formats
+   * @param array $params
+   *   Array of associative arrays in the order in which the buttons should be
+   *   displayed. The associate array has 3 fields: 'type', 'name' and 'isDefault'
+   *   The base form class will define a bunch of static arrays for commonly used
+   *   formats.
    *
    * @return void
    */
@@ -514,6 +515,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     foreach ($params as $button) {
       $attrs = array('class' => 'crm-form-submit') + (array) CRM_Utils_Array::value('js', $button);
 
+      if (!empty($button['class'])) {
+        $attrs['class'] .= ' ' . $button['class'];
+      }
+
       if (!empty($button['isDefault'])) {
         $attrs['class'] .= ' default';
       }
@@ -620,7 +625,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   /**
    * Setter function for options
    *
-   * @param mixed
+   * @param mixed $options
    *
    * @return void
    */
@@ -661,7 +666,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   /**
    * Setter function for Form Action
    *
-   * @param string
+   * @param string $action
    *
    * @return void
    */
@@ -710,10 +715,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       $tplname = $ext->getTemplatePath(CRM_Utils_System::getClassName($this)) . DIRECTORY_SEPARATOR . $filename;
     }
     else {
-      $tplname = str_replace('_',
-          DIRECTORY_SEPARATOR,
-          CRM_Utils_System::getClassName($this)
-        ) . '.tpl';
+      $tplname = strtr(
+        CRM_Utils_System::getClassName($this),
+        array(
+          '_' => DIRECTORY_SEPARATOR,
+          '\\' => DIRECTORY_SEPARATOR,
+        )
+      ) . '.tpl';
     }
     return $tplname;
   }
@@ -763,9 +771,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   /**
    * Store the variable with the value in the form scope
    *
-   * @param string name : name of the variable
-   * @param mixed value : value of the variable
-   *
+   * @param string $name
+   *   Name of the variable.
+   * @param mixed $value
+   *   Value of the variable.
    *
    * @return void
    */
@@ -776,8 +785,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   /**
    * Get the variable from the form scope
    *
-   * @param string name : name of the variable
-   *
+   * @param string $name
+   *   Name of the variable
    *
    * @return mixed
    */
@@ -1687,6 +1696,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    * that small pieces of duplication are not being refactored into separate functions because their only shared parent
    * is this form. Inserting a class FrontEndForm.php between the contribution & event & this class would allow functions like this
    * and a dozen other small ones to be refactored into a shared parent with the reduction of much code duplication
+   *
+   * @param $onlinePaymentProcessorEnabled
    */
   public function addCIDZeroOptions($onlinePaymentProcessorEnabled) {
     $this->assign('nocid', TRUE);