return $action->string( $user, 'Hello [username] !' );
Please Log in to join the conversation.
Please Log in to join the conversation.
You can't do that with PHP unless you're dealing with the saving part of it. The act of selecting an action never touches the server. It's just JavaScript. So you need to add custom JavaScript to display whatever you're wanting when someone selects an activity action from the dropdown.- in the post area a user can choose an action which has an id and is stored in the params of a single activity.
- selecting a specific id should trigger the display of a CB field in the post area (ajax ?)
- in a CB auto action, I'd like to condition the action of the auto action to the action of the activity. Say if activity action is #11, we execute such code or such auto action
Please Log in to join the conversation.
Please Log in to join the conversation.
As suggested below you should implement your own button with its own inputs and save behavior to fully implement exactly what you're wanting.
Please Log in to join the conversation.
// CODE TO CONFIGURE NEW FEATURE BUTTON
$buttonName = 'streamInputCUSTOM';
$buttonTarget = 'streamInputCUSTOMContainer';
$buttonDescription = 'Check out this new custom button!';
$buttonIcon = 'fa fa-heart';
$inputName = 'custom';
$inputLabel = 'LABEL';
$inputPlaceholder = 'PLACEHOLDER';
// CODE TO RENDER NEW FEATURE BUTTON
$variables['var1']['left'][] = '<button type="button" class="btn btn-light btn-sm border streamToggle ' . htmlspecialchars( $buttonName ) . '" data-cbactivity-toggle-target=".' . htmlspecialchars( $buttonTarget ) . '" data-cbactivity-toggle-active-classes="btn-info" data-cbactivity-toggle-inactive-classes="btn-light border" data-cbtooltip-tooltip="' . htmlspecialchars( $buttonDescription ) . '" data-hascbtooltip="true" data-cbtooltip-position-my="bottom center" data-cbtooltip-position-at="top center" data-cbtooltip-classes="qtip-simple"><span class="' . htmlspecialchars( $buttonIcon ) . '"></span></button>';
$substitutions = $action->substitutions();
$substitutions['input_name'] = htmlspecialchars( $inputName );
$substitutions['input_label'] = $inputLabel;
$substitutions['input_placeholder'] = htmlspecialchars( $inputPlaceholder );
$substitutions['input_class'] = htmlspecialchars( $buttonTarget );
$action->substitutions( $substitutions );
<div class="border-top d-flex cb_form_line streamItemInputGroup [input_class] hidden">
<div class="d-none d-sm-block col-form-label flex-shrink-1 p-2 border-right font-weight-bold streamItemInputGroupLabel">[input_label]</div>
<div class="flex-grow-1 streamItemInputGroupInput">
<input type="text" name="[input_name]" value="" class="form-control shadow-none border-0 w-100 streamInput" placeholder="[input_placeholder]">
</div>
</div>
$variables['var3']->params()->set( 'custom', $input->getString( 'custom' ) );
[var1_params_custom]
$variables['var5'] = $variables['var5'] . $content;
Please Log in to join the conversation.