Fixes to getting values from buttons

This commit is contained in:
Deon George 2022-08-30 12:01:13 +10:00
parent 9611939c57
commit 80c1768534

View File

@ -87,11 +87,13 @@ final class BlockActions extends Base
// For app hometab, the callback is in the view->callback_id array. // For app hometab, the callback is in the view->callback_id array.
return object_get($this->_data,sprintf('%s.%s',$this->container_type,$key)); return object_get($this->_data,sprintf('%s.%s',$this->container_type,$key));
case 'message_attachment':
return NULL;
default: default:
throw new SlackException('Unknown container type: '.$this->container_type); throw new SlackException('Unknown container type: '.$this->container_type);
} }
// @todo See if all responses have a container.type, and if so, put this in base.
case 'container_type': case 'container_type':
return object_get($this->_data,'container.type'); return object_get($this->_data,'container.type');
@ -113,14 +115,14 @@ final class BlockActions extends Base
case 'value': case 'value':
switch (object_get($this->action,'type')) { switch (object_get($this->action,'type')) {
case 'button':
return object_get($this->action,'text.text');
case 'external_select': case 'external_select':
case 'overflow': case 'overflow':
case 'static_select': case 'static_select':
return object_get($this->action,'selected_option.value'); return object_get($this->action,'selected_option.value');
case 'multi_static_select': case 'multi_static_select':
return object_get($this->action,'selected_options.value'); return object_get($this->action,'selected_options.value');
case 'button':
default: default:
return object_get($this->action,$key); return object_get($this->action,$key);
} }