/** * Get the ViewMeta object relating to this specific meta type. * * @return ViewMeta */ public function getViewMetaObject(){ $m = ViewMeta::Factory($this->get('meta_key')); $m->contentkey = $this->get('meta_value'); $m->content = $this->get('meta_value_title'); return $m; }
/** * (PHP 5 >= 5.0.0)<br/> * Offset to set * @link http://php.net/manual/en/arrayaccess.offsetset.php * @param mixed $offset <p> * The offset to assign the value to. * </p> * @param mixed $value <p> * The value to set. * </p> * @return void * * @throws Exception */ public function offsetSet($offset, $value) { if($offset === null){ // The user just wants the next available one. if($this->valid()){ $this->next(); } $offset = $this->key(); } // Is value already a viewmeta object? if($value instanceof ViewMeta || is_subclass_of($value, 'ViewMeta')){ if(isset($this->_links[$offset])){ // It's already set, merge the values in /** @var $existingmeta ViewMeta */ $existingmeta = $this->_links[$offset]; // Does it support multiples? if($existingmeta->multiple){ // If so, merge in the incoming meta. if(!is_array($existingmeta->content)){ $existingmeta->content = array( $existingmeta->contentkey => $existingmeta->content ); $existingmeta->contentkey = null; } $existingmeta->content[ $value->contentkey ] = $value->content; } else{ // If no, just replace the key and content :) $existingmeta->contentkey = $value->contentkey; $existingmeta->content = $value->content; } } else{ // It's not set, but it's still a ViewMeta object already! $this->_links[$offset] = $value; } // And my work is done here. return; } // Standard values... // Is it already set? if(isset($this->_links[$offset])){ /** @var $meta ViewMeta */ $meta = $this->_links[$offset]; } else{ // Create it! /** @var $meta ViewMeta */ $meta = ViewMeta::Factory($offset); $meta->parent = $this; $this->_links[$offset] = $meta; } $meta->content = $value; }