private function __appendBodyClass(array $context = array())
    {
        $body_class = '';

        foreach ($context as $key => $value) {
            if (is_numeric($value)) {
                $value = 'id-' . $value;

                // Add prefixes to all context values by making the
                // class be {key}-{value}. #1397 ^BA
            } elseif (!is_numeric($key) && isset($value)) {
                // Skip arrays
                if (is_array($value)) {
                    $value = null;
                } else {
                    $value = str_replace('_', '-', $key) . '-'. $value;
                }
            }

            if ($value !== null) {
                $body_class .= trim($value) . ' ';
            }
        }

        $classes = array_merge(explode(' ', trim($body_class)), explode(' ', trim($this->_body_class)));
        $body_class = trim(implode(' ', $classes));

        if (!empty($body_class)) {
            $this->Body->setAttribute('class', $body_class);
        }
    }
private function __appendBodyClass(array $context = array())
    {
        $body_class = '';

        foreach ($context as $key => $value) {
            if (is_numeric($value)) {
                $value = 'id-' . $value;

                // Add prefixes to all context values by making the
                // class be {key}-{value}. #1397 ^BA
            } elseif (!is_numeric($key) && isset($value)) {
                // Skip arrays
                if (is_array($value)) {
                    $value = null;
                } else {
                    $value = str_replace('_', '-', $key) . '-'. $value;
                }
            }

            if ($value !== null) {
                $body_class .= trim($value) . ' ';
            }
        }

        $classes = array_merge(explode(' ', trim($body_class)), explode(' ', trim($this->_body_class)));
        $body_class = trim(implode(' ', $classes));

        if (!empty($body_class)) {
            $this->Body->setAttribute('class', $body_class);
        }
    }
private function __appendBodyClass ( array $ context = array ( ) ) { $ body_class = '' ; foreach ( $ context as $ key => $ value ) { if ( is_numeric ( $ value ) ) { $ value = 'id-' . $ value ; // Add prefixes to all context values by making the // class be {key}-{value}. #1397 ^BA } elseif ( ! is_numeric ( $ key ) && isset ( $ value ) ) { // Skip arrays if ( is_array ( $ value ) ) { $ value = null ; } else { $ value = str_replace ( '_' , '-' , $ key ) . '-' . $ value ; } } if ( $ value !== null ) { $ body_class .= trim ( $ value ) . ' ' ; } } $ classes = array_merge ( explode ( ' ' , trim ( $ body_class ) ) , explode ( ' ' , trim ( $ this -> _body_class ) ) ) ; $ body_class = trim ( implode ( ' ' , $ classes ) ) ; if ( ! empty ( $ body_class ) ) { $ this -> Body -> setAttribute ( 'class' , $ body_class ) ; } }
Given the context of the current page, which is an associative
array, this function will append the values to the page's body as
classes. If an context value is numeric it will be prepended by 'id-',
otherwise all classes will be prefixed by the context key.

@param array $context
Given the context of the current page which is an associative array this function will append the values to the page s body as classes . If an context value is numeric it will be prepended by id - otherwise all classes will be prefixed by the context key .