Ejemplo n.º 1
0
 /**
  * Magic unset method.
  *
  * This is only for child elements, not properties.
  *
  * @param mixed $name
  *   The name of the child element to unset.
  *
  * @throws \InvalidArgumentException
  *   Throws this error when the name is a property (key starting with #).
  */
 public function __unset($name)
 {
     if (\Drupal\Core\Render\Element::property($name)) {
         throw new \InvalidArgumentException('Cannot dynamically unset an element property. Use \\Drupal\\bootstrap\\Utility\\Element::hasProperty instead.');
     }
     parent::__unset($name);
 }
Ejemplo n.º 2
0
 /**
  * Tests the property() method.
  */
 public function testProperty()
 {
     $this->assertTrue(Element::property('#property'));
     $this->assertFalse(Element::property('property'));
     $this->assertFalse(Element::property('property#'));
 }