| @@ -1872,15 +1872,10 @@ | ||
| 1872 | 1872 | } |
| 1873 | 1873 | } |
| 1874 | 1874 | |
| 1875 | 1875 | protected function do_print_elements( $elements_data ) { |
| 1876 | - // Collect all data updaters that should be updated on runtime. | |
| 1877 | - $runtime_elements_iteration_actions = $this->get_runtime_elements_iteration_actions(); | |
| 1876 | + $this->update_runtime_elements( $elements_data ); | |
| 1878 | 1877 | |
| 1879 | - if ( $runtime_elements_iteration_actions ) { | |
| 1880 | - $this->iterate_elements( $elements_data, $runtime_elements_iteration_actions, 'render' ); | |
| 1881 | - } | |
| 1882 | - | |
| 1883 | 1878 | foreach ( $elements_data as $element_data ) { |
| 1884 | 1879 | $element = Plugin::$instance->elements_manager->create_element_instance( $element_data ); |
| 1885 | 1880 | |
| 1886 | 1881 | if ( ! $element ) { |
| @@ -1887,8 +1882,21 @@ | ||
| 1887 | 1882 | continue; |
| 1888 | 1883 | } |
| 1889 | 1884 | |
| 1890 | 1885 | $element->print_element(); |
| 1886 | + } | |
| 1887 | + } | |
| 1888 | + | |
| 1889 | + public function update_runtime_elements( $elements_data = null ) { | |
| 1890 | + if ( null === $elements_data ) { | |
| 1891 | + $elements_data = $this->get_elements_data(); | |
| 1892 | + } | |
| 1893 | + | |
| 1894 | + // Collect all data updaters that should be updated on runtime. | |
| 1895 | + $runtime_elements_iteration_actions = $this->get_runtime_elements_iteration_actions(); | |
| 1896 | + | |
| 1897 | + if ( $runtime_elements_iteration_actions ) { | |
| 1898 | + $this->iterate_elements( $elements_data, $runtime_elements_iteration_actions, 'render' ); | |
| 1891 | 1899 | } |
| 1892 | 1900 | } |
| 1893 | 1901 | |
| 1894 | 1902 | public function set_document_cache( $value ) { |