Utils/Element.php
/**
     * Prepare element - build element settings using global settings
     *
     * @param mixed $attributes , can be a string, an array of attributes or an array with both attributes and settings
     * @param array $settings , settings if not submitted via $arguments
     * @return array
     */
Prepare element - build element settings using global settings
@param mixed $attributes , can be a string, an array of attributes or an array with both attributes and settings
@param array $settings , settings if not submitted via $arguments
@return array
Prepare element - build element settings using global settings @param mixed $attributes can be a string an array of attributes or an array with both attributes and settings @param array $settings settings if not submitted via $arguments @return array
protected static function prepare($attributes = array(), $settings = array())
    {
        if ($settings['element'] == 'form'
            && !isset(self::$settings['form']['attributes']['action'])
        ) {
            self::$settings['form']['attributes']['action'] = $_SERVER['REQUEST_URI'];
        }
        if (is_numeric(self::$settings['global settings']['indent'])) {
            self::$settings['global settings']['indent'] = str_repeat(
                ' ',
                self::$settings['global settings']['indent']
            );
        }
        $element_setup = !empty(self::$settings[$settings['element']])
            ? self::$settings[$settings['element']]
            : array();
        $element_setup['settings'] = !empty($element_setup['settings'])
            ? array_merge(self::$settings['global settings'], $element_setup['settings'], $settings)
            : array_merge(self::$settings['global settings'], $settings);
        if (!empty($attributes) && is_string($attributes)) {
            $attributes = array(
                'content' => $attributes
            );
        }
        $element_setup['attributes'] = !empty($element_setup['attributes'])
            ? array_merge($element_setup['attributes'], $attributes)
            : $attributes;
        $attr_settings             = array_intersect_key($element_setup['attributes'], $element_setup['settings']);
        $element_setup['settings'] = array_merge($element_setup['settings'], $attr_settings);
        $element_setup['attributes'] = array_diff_key($element_setup['attributes'], $attr_settings);
        return $element_setup;
    }
protected static function prepare ( $ attributes = array ( ) , $ settings = array ( ) ) { if ( $ settings [ 'element' ] == 'form' && ! isset ( self :: $ settings [ 'form' ] [ 'attributes' ] [ 'action' ] ) ) { self :: $ settings [ 'form' ] [ 'attributes' ] [ 'action' ] = $ _SERVER [ 'REQUEST_URI' ] ; } if ( is_numeric ( self :: $ settings [ 'global settings' ] [ 'indent' ] ) ) { self :: $ settings [ 'global settings' ] [ 'indent' ] = str_repeat ( ' ' , self :: $ settings [ 'global settings' ] [ 'indent' ] ) ; } $ element_setup = ! empty ( self :: $ settings [ $ settings [ 'element' ] ] ) ? self :: $ settings [ $ settings [ 'element' ] ] : array ( ) ; $ element_setup [ 'settings' ] = ! empty ( $ element_setup [ 'settings' ] ) ? array_merge ( self :: $ settings [ 'global settings' ] , $ element_setup [ 'settings' ] , $ settings ) : array_merge ( self :: $ settings [ 'global settings' ] , $ settings ) ; if ( ! empty ( $ attributes ) && is_string ( $ attributes ) ) { $ attributes = array ( 'content' => $ attributes ) ; } $ element_setup [ 'attributes' ] = ! empty ( $ element_setup [ 'attributes' ] ) ? array_merge ( $ element_setup [ 'attributes' ] , $ attributes ) : $ attributes ; $ attr_settings = array_intersect_key ( $ element_setup [ 'attributes' ] , $ element_setup [ 'settings' ] ) ; $ element_setup [ 'settings' ] = array_merge ( $ element_setup [ 'settings' ] , $ attr_settings ) ; $ element_setup [ 'attributes' ] = array_diff_key ( $ element_setup [ 'attributes' ] , $ attr_settings ) ; return $ element_setup ; }
Prepare element - build element settings using global settings
 @param mixed $attributes , can be a string, an array of attributes or an array with both attributes and settings
 @param array $settings , settings if not submitted via $arguments
 @return array
Prepare element - build element settings using global settings @param mixed $attributes can be a string an array of attributes or an array with both attributes and settings @param array $settings settings if not submitted via $arguments @return array
// assign default form action since $_SERVER cannot be used in $instance // element preset // merge global settings, elemnet settings and submitted settings // allow single string as argument, this will be by default the content // stuff submitted as attributes // copy 'attributes' that are actually settings over // remove the above from attributes