<?php
/**
* Jetpack CRM Automation New_Contact action.
*
* @package automattic/jetpack-crm
* @since 6.2.0
*/
namespace Automattic\Jetpack\CRM\Automation\Actions;
use Automattic\Jetpack\CRM\Automation\Base_Action;
use Automattic\Jetpack\CRM\Automation\Data_Types\Contact_Data;
use Automattic\Jetpack\CRM\Automation\Data_Types\Data_Type;
/**
* Adds the New_Contact class.
*
* @since 6.2.0
*/
class New_Contact extends Base_Action {
/**
* Get the slug name of the step.
*
* @since 6.2.0
*
* @return string The slug name of the step.
*/
public static function get_slug(): string {
return 'jpcrm/new_contact';
}
/**
* Get the title of the step.
*
* @since 6.2.0
*
* @return string|null The title of the step.
*/
public static function get_title(): ?string {
return 'New Contact Action';
}
/**
* Get the description of the step.
*
* @since 6.2.0
*
* @return string|null The description of the step.
*/
public static function get_description(): ?string {
return 'Action to add the new contact';
}
/**
* Get the data type.
*
* @since 6.2.0
*
* @return string The type of the step.
*/
public static function get_data_type(): string {
return Contact_Data::class;
}
/**
* Get the category of the step.
*
* @since 6.2.0
*
* @return string|null The category of the step.
*/
public static function get_category(): ?string {
return __( 'Contact', 'zero-bs-crm' );
}
/**
* Add the new contact to the DAL.
*
* @since 6.2.0
*
* @param Data_Type $data Data passed from the trigger.
*/
protected function execute( Data_Type $data ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
global $zbs;
$zbs->DAL->contacts->addUpdateContact( $this->attributes ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
}
}