Stash::_update_list PHP Метод

_update_list() приватный Метод

Append / prepend to array
private _update_list ( boolean $append = TRUE ) : string
$append boolean Append or prepend to an existing list?
Результат string
    private function _update_list($append = TRUE)
    {
        $name = $this->EE->TMPL->fetch_param('name');
        $context = $this->EE->TMPL->fetch_param('context', NULL);
        $this->EE->TMPL->tagdata = $this->_parse_output($this->EE->TMPL->tagdata);
        $this->parse_complete = TRUE;
        // make sure we don't run parsing again
        // get stash variable pairs (note: picks up outer pairs, nested pairs and singles are ignored)
        preg_match_all('#' . LD . '(stash:[a-z0-9\\-_]+)' . RD . '.*?' . LD . '/\\g{1}' . RD . '#ims', $this->EE->TMPL->tagdata, $matches);
        if (isset($matches[1])) {
            $this->EE->TMPL->var_pair = array_flip(array_unique($matches[1]));
        }
        // format our list
        $this->_serialize_stash_tag_pairs();
        if ($this->not_empty($this->EE->TMPL->tagdata)) {
            // does the list really exist?
            if ($context !== NULL && count(explode(':', $name) == 1)) {
                $name = $context . ':' . $name;
            }
            $name_in_context = $this->_parse_context($name);
            // get the current value of the list
            $current_value = '';
            if (array_key_exists($name, $this->_stash)) {
                $current_value = $this->_stash[$name];
            } elseif (array_key_exists($name_in_context, $this->_stash)) {
                $current_value = $this->_stash[$name_in_context];
            }
            // check that the list has a value before appending/prepending
            if ($this->not_empty($current_value)) {
                if ($append) {
                    $this->EE->TMPL->tagdata = $this->_list_delimiter . $this->EE->TMPL->tagdata;
                } else {
                    $this->EE->TMPL->tagdata = $this->EE->TMPL->tagdata . $this->_list_delimiter;
                }
            }
            // update the list, but do we need to disable match/against?
            if (FALSE !== $this->EE->TMPL->fetch_param('against', FALSE)) {
                // already matched/against a specified column in the list, so disable match/against
                unset($this->EE->TMPL->tagparams['match']);
                unset($this->EE->TMPL->tagparams['against']);
            }
            return $append ? $this->append() : $this->prepend();
        }
    }