/** * This isn't just the name of an input, it's a path pointing to an input. The * path is similar to a folder path: slash (/) means to descend into a subsection, * dot-dot-slash (../) means to ascend into the parent section. * After a series of slashes and dot-dot-slashes, there should be the name of an input, * which will be returned. * Eg, if you want the related input to be conditional on a sibling input name 'foobar' * just use 'foobar'. If you want it to be conditional on an aunt/uncle input name * 'baz', use '../baz'. If you want it to be conditional on a cousin input, * the child of 'baz_section' named 'baz_child', use '../baz_section/baz_child'. * Etc * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false * @return EE_Form_Section_Base */ public function find_section_from_path($form_section_path) { //check if we can find the input from purely going straight up the tree $input = parent::find_section_from_path($form_section_path); if ($input instanceof EE_Form_Section_Base) { return $input; } $next_slash_pos = strpos($form_section_path, '/'); if ($next_slash_pos !== false) { $child_section_name = substr($form_section_path, 0, $next_slash_pos); $subpath = substr($form_section_path, $next_slash_pos + 1); } else { $child_section_name = $form_section_path; $subpath = ''; } $child_section = $this->get_subsection($child_section_name); if ($child_section instanceof EE_Form_Section_Base) { return $child_section->find_section_from_path($subpath); } else { return null; } }
/** * @param $parent_form_section * @param $name */ function _construct_finalize($parent_form_section, $name) { parent::_construct_finalize($parent_form_section, $name); $this->_set_default_html_name_if_empty(); if (!$this->_html_label) { if (!$this->_html_label_text) { $this->_html_label_text = ucwords(str_replace("_", " ", $name)); } } do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); }
/** * @param $parent_form_section * @param $name */ function _construct_finalize($parent_form_section, $name) { parent::_construct_finalize($parent_form_section, $name); $this->_set_default_html_name_if_empty(); if (!$this->_html_label) { if (!$this->_html_label_text) { $this->_html_label_text = ucwords(str_replace("_", " ", $name)); } } }
/** * * @return EE_Form_Section_Proper */ public function parent_section() { $this->ensure_construct_finalized_called(); return parent::parent_section(); }