protected function tagOptions(array $options = array(), $escape = false) { $opts = array(); if (isset($options['allowBlankAttrs'])) { $allowBlankAttrs = true; unset($options['allowBlankAttrs']); } else { $allowBlankAttrs = false; } foreach ($options as $opt => $val) { # "class" attribute allows array. if ($opt == 'class' && is_array($val)) { $val = implode(' ', \Rails\Toolbox\ArrayTools::flatten($val)); } if (is_array($val)) { $val = implode(' ', $val); } if ((string) $val === '' && !$allowBlankAttrs) { continue; } if (is_int($opt)) { $opts[] = $val; } else { $escape && ($val = htmlentities($val)); $opts[] = $opt . '="' . $val . '"'; } } return implode(' ', $opts); }
private function addNestedParams(&$url, array &$params) { if ($this->scopeParams) { $scopeParams = []; foreach ($this->scopeParams as $k => $param) { $scopeParams = array_merge($scopeParams, $param); } $params = array_merge($scopeParams, $params); } if ($this->modules) { if (!isset($params['module'])) { $params['module'] = []; } else { $params['module'] = explode('/', $params['module']); } $params['modules'] = array_filter(array_merge($this->modules, $params['module'])); unset($params['module']); } if ($this->paths) { if (!isset($params['path'])) { $params['path'] = []; } else { $params['path'] = explode('/', $params['path']); } $params['paths'] = array_filter(array_merge(Toolbox\ArrayTools::flatten($this->paths), $params['path'])); unset($params['path']); } }