$item_data ) { $item_id = apply_filters( 'bathemos_valid_array_id', $item_id, $item_data ); if ( ! $item_id ) { continue; } // Format data. $source = apply_filters( 'bathemos_formatted_source', $item_data ); $source['tag'] = $item_id; if ( ! $source['id'] ) { $source['id'] = $source['default']; } // Get item source. $source = apply_filters( 'bathemos_source', $source, $use_default = true ); self::$data[ $item_id ] = $source; } } //////////////////////////////////////////////////////////// //// Provide data. //////////////////////////////////////////////////////////// ////////////////////////////////////////////////// /** * Returns components list. * * @since 1.0.0 * * @param array $content Content to filter. * * @return array */ static function get_data( $content = null ) { return self::$data; } ////////////////////////////////////////////////// /** * Returns specific component data. * * @since 1.0.0 * * @param array $content Content to filter. * @param string $tag Component tag. * * @return array */ static function get_component( $content, $tag ) { $tag = apply_filters( 'bathemos_core_input', $tag ); if ( isset( self::$data[ $tag ] ) ) { return self::$data[ $tag ]; } return $content; } ////////////////////////////////////////////////// /** * Returns components list altered by the gived array. * * @since 1.0.0 * * @param array $content Content to filter. * @param array $altering Altering array. * * @return array */ static function get_components_altering( $content, $altering = array() ) { foreach ( $altering as $item_tag => $item_id ) { $source = array(); $source['tag'] = $item_tag; $source['id'] = $item_id; $source = apply_filters( 'bathemos_source', $source, $use_default = false ); if ( ( $source['path'] ) || ( $item_id == 'custom' ) ) { $content[ $item_tag ] = $source; } } return $content; } //////////////////////////////////////////////////////////// //// End of our class. //////////////////////////////////////////////////////////// }