Comment to 'How to make a new profile block'
  • Hi all!

    So let's review the existing "Info" block has the value of service method as 'entity_info'. It means that BxPersonsModule class has the method serviceEntityInfo which "draws" this block. This method is declared in the parent BxBaseModGeneralModule class and has the following view:

    public function serviceEntityInfo ($iContentId = 0, $sDisplay = false)

        {

            return $this->_serviceEntityForm ('viewDataForm', $iContentId, $sDisplay);

        }

    The code of method _serviceEntityForm:

    protected function _serviceEntityForm ($sFormMethod, $iContentId = 0, $sDisplay = false, $sCheckFunction = false, $bErrorMsg = true)

        {

            $iContentId = $this->_getContent($iContentId, false);

            if($iContentId === false)

                return false;

            bx_import('FormsEntryHelper', $this->_aModule);

            $sClass = $this->_aModule['class_prefix'] . 'FormsEntryHelper';

            $oFormsHelper = new $sClass($this);

            return $oFormsHelper->$sFormMethod((int)$iContentId, $sDisplay, $sCheckFunction, $bErrorMsg);

        }

    So it means that it will load the ViewDataForm method of BxPersonsFormsEntryHelper class which has the following code (in the parent class BxBaseModGeneralFormsEntryHelper):

    public function viewDataForm ($iContentId, $sDisplay = false)

        {

            $CNF = &$this->_oModule->_oConfig->CNF;

            // get content data and profile info

            list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);

            if (!$aContentInfo)

                return MsgBox(_t('_sys_txt_error_entry_is_not_defined'));

            // check access

            if ($sMsg = $this->_processPermissionsCheckForViewDataForm ($aContentInfo, $oProfile))

                return MsgBox($sMsg);

            // get form

            $oForm = $this->getObjectFormView($sDisplay);

            if (!$oForm)

                return MsgBox(_t('_sys_txt_error_occured'));

            // process metatags

            if (!empty($CNF['OBJECT_METATAGS'])) {

                $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);

                if ($oMetatags->keywordsIsEnabled()) {

                    $aFields = $oMetatags->metaFields($aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']);

                    $oForm->setMetatagsKeywordsData($iContentId, $aFields, $oMetatags);

                }

            }        

            // display profile

            $oForm->initChecker($aContentInfo);

            return $oForm->getCode();

        }

    So, in the BxPersonsModule class, you may create a new method like serviceEntityInfoAdv (and call it in the block like 'entity_info_adv') which may combine the code from the given methods. So there you may define the list of necessary fields and remove it from $aContentInfo array.