dataSheet; } /** * Whether dataSheet is attached for this class or not * * @return bool */ public function hasDataSheet() { return !empty( $this->dataSheet ); } /** * Sets dataSheet * * @param array $dataSheet */ public function setDataSheet( $dataSheet ) { $this->dataSheet = $dataSheet; } /** * Retrieves the current dataSheet ID if dataSource exits * * @return string */ public function getDataSheetID() { return $this->maybeReplaceDataSheetTags('{{{uuid}}}', ''); } /** * Retrieves data tag value if exists * * @param $tag * * @return mixed|string */ public function getDataSheetTagValue( $tag ) { return $this->hasDataSheet() ? \Depicter::dataSource()->tagsManager()->convert( $tag, $this->getDataSheet() ) : ''; } /** * Retrieves url of this dataSheet * * @return string */ public function getDataSheetUrl() { return $this->maybeReplaceDataSheetTags('{{{url}}}', ''); } /** * Whether section is linked to corresponding dataSheet or not * * @return false */ public function isLinkedToDataSheet(){ return $this->maybeReplaceDataSheetTags('{{{linkSlides}}}', false); } /** * Replace dataSheets tags if exits * * @param $variable * @param $default * * @return array|mixed|string|string[] */ protected function maybeReplaceDataSheetTags( $variable, $default = null ){ if( $dataSheet = $this->getDataSheet() ){ return \Depicter::dataSource()->tagsManager()->convert( $variable, $dataSheet ); } if( ! is_null( $default ) ){ return $default; } return $variable; } }