|string $options Options. * @param Schema\Schema $schema Schema. */ public function __construct( $options, Schema\Schema $schema ) { if ( is_array( $options ) && isset( $options['hook'] ) && has_action( $options['hook'] ) ) { $this->hook = preg_replace( '/[A-Za-z0-9_-]/', '', $options['hook'] ); } parent::__construct( $options, $schema ); } /** * @return array */ public function to_json() { return [ 'action' => 'action', 'actionOption' => [ 'hook' => $this->hook, ], ]; } /** * @return bool */ public function should_save() { return false; } /** * @param int $row_id * @param array $row * @param Source\Source $source * @param array $columns * @return array */ public function perform( $row_id, array $row, Source\Source $source, array $columns ) { if ( ! $this->hook || ! $this->should_save() ) { return $columns; } do_action( $this->hook, $row, $row_id, $source, $columns ); return $columns; } }