Example #1
0
 /**
  * @param string $key
  * @param string $value
  *
  * @throws InvalidArgumentException
  * @return $this
  */
 public function set_attribute($key, $value)
 {
     if ($key == 'type') {
         // we don't let the type attribute change
         throw new InvalidArgumentException(__('"type" attribute may not be changed', 'wp-forms'));
     } elseif ($key == 'value') {
         throw new InvalidArgumentException(__("Use WP_Form_Element::set_value() to change an element's value", 'wp-forms'));
     }
     $this->attributes->set_attribute($key, $value);
     return $this;
 }
Example #2
0
 public function set_attribute($key, $value)
 {
     $this->attributes->set_attribute($key, $value);
     return $this;
 }