[ 'value' => [ 'type' => 'blob', 'size' => 'big', 'serialize' => TRUE, ], ], ]; } /** * {@inheritdoc} */ public function toArray() { // The default implementation of toArray() only returns known properties. // For a map, return everything as the properties are not pre-defined. return $this->getValue(); } /** * {@inheritdoc} */ public function setValue($values, $notify = TRUE) { $this->values = []; if (!isset($values)) { return; } if (!is_array($values)) { if ($values instanceof MapItem) { $values = $values->getValue(); } else { $values = unserialize($values); } } $this->values = $values; // Notify the parent of any changes. if ($notify && isset($this->parent)) { $this->parent->onChange($this->name); } } /** * {@inheritdoc} */ public function __get($name) { if (!isset($this->values[$name])) { $this->values[$name] = []; } return $this->values[$name]; } /** * {@inheritdoc} */ public function __set($name, $value) { if (isset($value)) { $this->values[$name] = $value; } else { unset($this->values[$name]); } } /** * {@inheritdoc} */ public static function mainPropertyName() { // A map item has no main property. return NULL; } /** * {@inheritdoc} */ public function isEmpty() { return empty($this->values); } }