_data,'view.'.$key); case 'meta': return object_get($this->_data,'view.private_metadata'); case 'view_id': return object_get($this->_data,'view.id'); default: return parent::__get($key); } } /** * This method should be overridden by a local implementation * * @return Message */ public function respond(): Modal { // Do some magic with event data Log::info(sprintf('%s:View Submission for Callback [%s] User [%s] in [%s]',self::LOGKEY,$this->callback_id,$this->user_id,$this->team_id),['m'=>__METHOD__]); $action = NULL; $id = NULL; if (preg_match('/^(.*)\|([0-9]+)/',$this->callback_id)) { [$action,$cid] = explode('|',$this->callback_id,2); } elseif (preg_match('/^[a-z_]+$/',$this->callback_id)) { $action = $this->callback_id; } else { // If we get here, its an action that we dont know about. Log::notice(sprintf('%s:Unhandled CALLBACK [%s]',static::LOGKEY,$this->callback_id),['m'=>__METHOD__]); } switch ($action) { default: Log::notice(sprintf('%s:Unhandled ACTION [%s]',self::LOGKEY,$action),['m'=>__METHOD__]); } return new Modal(new Team); } protected function blocks(): Collection { $result = collect(); foreach (object_get($this->_data,'view.blocks',[]) as $id=>$block) { switch (object_get($block,'type')) { case 'input': $result->put($block->element->action_id,$block->block_id); break; case 'section': $result->put($block->block_id,$id); break; } } return $result; } public function value(string $block_id): ?string { $key = Arr::get($this->blocks(),$block_id); // Return the state value, or the original block value return object_get($this->_data,'view.state.values.'.$key.'.'.$block_id.'.value') ?: object_get(Arr::get(object_get($this->_data,'view.blocks'),$key),'text.text',''); } }