Example #1
0
 /**
  * Get whether this should be displayed in LTR mode.
  *
  * Try to guess from the PARAM type unless specifically set.
  */
 public function get_force_ltr() {
     $forceltr = parent::get_force_ltr();
     if ($forceltr === null) {
         return !is_rtl_compatible($this->paramtype);
     }
     return $forceltr;
 }
Example #2
0
 /**
  * Should be used for all elements of a form except for select, radio and checkboxes which
  * clean their own data.
  *
  * @param string $elementname
  * @param int $paramtype defines type of data contained in element. Use the constants PARAM_*.
  *        {@link lib/moodlelib.php} for defined parameter types
  */
 function setType($elementname, $paramtype)
 {
     $this->_types[$elementname] = $paramtype;
     // This will not always get it right, but it should be accurate in most cases.
     // When inaccurate use setForceLtr().
     if (!is_rtl_compatible($paramtype) && $this->elementExists($elementname) && ($element =& $this->getElement($elementname)) && method_exists($element, 'set_force_ltr')) {
         $element->set_force_ltr(true);
     }
 }