_show = $show; } else { $this->_show = []; } if (!empty($hide)) { $this->_hide = $hide; } else { $this->_hide = []; } } /** * Add the values from this class to the template. */ public function addToTemplate() { $hide = $show = ''; $first = TRUE; foreach (array_keys($this->_hide) as $h) { if (!$first) { $hide .= ','; } $hide .= "'$h'"; $first = FALSE; } $first = TRUE; foreach (array_keys($this->_show) as $s) { if (!$first) { $show .= ','; } $show .= "'$s'"; $first = FALSE; } $template = CRM_Core_Smarty::singleton(); $template->ensureVariablesAreAssigned(['elemType']); $template->assign_by_ref('hideBlocks', $hide); $template->assign_by_ref('showBlocks', $show); } /** * Add a value to the show array. * * @param string $name * Id to be added. */ public function addShow($name) { $this->_show[$name] = 1; if (array_key_exists($name, $this->_hide)) { unset($this->_hide[$name]); } } /** * Add a value to the hide array. * * @param string $name * Id to be added. */ public function addHide($name) { $this->_hide[$name] = 1; if (array_key_exists($name, $this->_show)) { unset($this->_show[$name]); } } }