public function get_markup() { $this->markup = Atom::assemble($this->name, $this); }
/** * get_structure_part * * Get a part of the structure: returns either a plain atom or a named atom based on the args. * * @since 0.1.0 * @see CNP/Atom * * @param string $atom_name The base atom name, modified to be namespaced by the organism name. * @param array $atom_args The atom args * @param WP_Post $post_obj Post object * * @return mixed */ protected function get_structure_part($atom_name, $atom_args, $post_obj) { // First, namespace the atom based on the organism name. if (isset($atom_args['name'])) { $namespaced_atom_name = $this->name . $this->separator . $atom_args['name']; } if (!isset($atom_args['name'])) { $namespaced_atom_name = $this->name . $this->separator . $atom_name; } $class_atom_suffix = $atom_name; if (isset($atom_args['atom'])) { $class_atom_suffix = $atom_args['atom']; } // Set up the class to check against $class_atom_name = 'CNP\\' . $class_atom_suffix; // If class isn't set already, then it defaults to an array. if (!isset($atom_args['attributes']['class'])) { $atom_args['attributes']['class'] = array(); } // Shorthand for class if (isset($atom_args['class'])) { // The utility function takes either a string or array, and returns an array. $classes_arr = Utility::parse_classes_as_array($atom_args['class']); if (!empty($classes_arr)) { // $atom_args['attributes']['class'] has been pre-set as an array, so the merge here is safe. $atom_args['attributes']['class'] = array_merge($atom_args['attributes']['class'], $classes_arr); } } // Add the $post to $atom_args, if it is present. if (isset($post_obj)) { $atom_args['post'] = $post_obj; } // Set up the atom class. $atom_args['attributes']['class'][] = $namespaced_atom_name; // Set up atom filter suppression, or not $atom_args['suppress_filters'] = $this->suppress_filters; // If the class exists, then it's a named atom, and we need to // run the get_markup method based on the namespaced atom name. if (class_exists($class_atom_name)) { $atom_args['name'] = $namespaced_atom_name; $atom_object = new $class_atom_name($atom_args); $atom_object->get_markup(); return $atom_object->markup; } // If the class does not exist, then it's a generic atom. // Run it through the Atom class to assemble it if (!class_exists($class_atom_name)) { $atom = Atom::assemble($namespaced_atom_name, $atom_args); return $atom; } return true; }