Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions includes/blocks/class-convertkit-block-broadcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct() {
// Register this as a Gutenberg block in the ConvertKit Plugin.
add_filter( 'convertkit_blocks', array( $this, 'register' ) );

// Register this block's MCP abilities.
add_filter( 'convertkit_abilities', array( $this, 'register_abilities' ) );

// Enqueue scripts and styles for this Gutenberg Block in the editor and frontend views.
add_action( 'convertkit_gutenberg_enqueue_scripts_editor_and_frontend', array( $this, 'enqueue_scripts' ) );
add_action( 'convertkit_gutenberg_enqueue_styles_editor_and_frontend', array( $this, 'enqueue_styles' ) );
Expand Down Expand Up @@ -171,6 +174,19 @@ public function get_title() {

}

/**
* Returns this block's plural title.
*
* @since 3.4.0
*
* @return string
*/
public function get_title_plural() {

return __( 'Kit Broadcasts', 'convertkit' );

}

/**
* Returns this block's icon.
*
Expand Down
16 changes: 16 additions & 0 deletions includes/blocks/class-convertkit-block-form-trigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct() {
// Register this as a Gutenberg block in the ConvertKit Plugin.
add_filter( 'convertkit_blocks', array( $this, 'register' ) );

// Register this block's MCP abilities.
add_filter( 'convertkit_abilities', array( $this, 'register_abilities' ) );

// Enqueue scripts and styles for this Gutenberg Block in the editor and frontend views.
add_action( 'convertkit_gutenberg_enqueue_styles_editor_and_frontend', array( $this, 'enqueue_styles' ) );

Expand Down Expand Up @@ -73,6 +76,19 @@ public function get_title() {

}

/**
* Returns this block's plural title.
*
* @since 3.4.0
*
* @return string
*/
public function get_title_plural() {

return __( 'Kit Form Triggers', 'convertkit' );

}

/**
* Returns this block's icon.
*
Expand Down
16 changes: 16 additions & 0 deletions includes/blocks/class-convertkit-block-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct() {
// Register this as a Gutenberg block in the ConvertKit Plugin.
add_filter( 'convertkit_blocks', array( $this, 'register' ) );

// Register this block's MCP abilities.
add_filter( 'convertkit_abilities', array( $this, 'register_abilities' ) );

// Enqueue scripts for this Gutenberg Block in the editor view.
add_action( 'convertkit_gutenberg_enqueue_scripts', array( $this, 'enqueue_scripts_editor' ) );

Expand Down Expand Up @@ -101,6 +104,19 @@ public function get_title() {

}

/**
* Returns this block's plural title.
*
* @since 3.4.0
*
* @return string
*/
public function get_title_plural() {

return __( 'Kit Forms', 'convertkit' );

}

/**
* Returns this block's icon.
*
Expand Down
16 changes: 16 additions & 0 deletions includes/blocks/class-convertkit-block-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct() {
// Register this as a Gutenberg block in the ConvertKit Plugin.
add_filter( 'convertkit_blocks', array( $this, 'register' ) );

// Register this block's MCP abilities.
add_filter( 'convertkit_abilities', array( $this, 'register_abilities' ) );

// Enqueue scripts and styles for this Gutenberg Block in the editor and frontend views.
add_action( 'convertkit_gutenberg_enqueue_scripts_editor_and_frontend', array( $this, 'enqueue_scripts' ) );
add_action( 'convertkit_gutenberg_enqueue_styles_editor_and_frontend', array( $this, 'enqueue_styles' ) );
Expand Down Expand Up @@ -95,6 +98,19 @@ public function get_title() {

}

/**
* Returns this block's plural title.
*
* @since 3.4.0
*
* @return string
*/
public function get_title_plural() {

return __( 'Kit Products', 'convertkit' );

}

/**
* Returns this block's icon.
*
Expand Down
21 changes: 17 additions & 4 deletions includes/blocks/class-convertkit-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public function register_abilities( $abilities ) {
return array_merge(
$abilities,
array(
new ConvertKit_MCP_Ability_Content_List( $this ),
new ConvertKit_MCP_Ability_Content_Insert( $this ),
new ConvertKit_MCP_Ability_Content_Update( $this ),
new ConvertKit_MCP_Ability_Content_Delete( $this ),
'kit/' . $this->get_name() . '-list' => new ConvertKit_MCP_Ability_Content_List( $this ),
'kit/' . $this->get_name() . '-insert' => new ConvertKit_MCP_Ability_Content_Insert( $this ),
'kit/' . $this->get_name() . '-update' => new ConvertKit_MCP_Ability_Content_Update( $this ),
'kit/' . $this->get_name() . '-delete' => new ConvertKit_MCP_Ability_Content_Delete( $this ),
)
);

Expand Down Expand Up @@ -105,6 +105,19 @@ public function get_title() {

}

/**
* Returns this block's plural title.
*
* @since 3.4.0
*
* @return string
*/
public function get_title_plural() {

return '';

}

/**
* Returns this block's icon.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function get_label() {

return sprintf(
/* translators: %s: block title */
__( 'Delete an existing %s element from a post', 'convertkit' ),
__( 'Delete Existing %s from a Post, Page or Custom Post', 'convertkit' ),
$this->block->get_title()
);

Expand All @@ -67,10 +67,9 @@ public function get_label() {
public function get_description() {

return sprintf(
/* translators: 1: block full name e.g. convertkit/form, 2: block title */
__( 'Removes a single occurrence of the %1$s (%2$s) element from the given post.', 'convertkit' ),
'convertkit/' . $this->block->get_name(),
$this->block->get_title()
/* translators: Block Name */
__( 'Removes an existing %s from a Post, Page or Custom Post using the supplied zero-based occurrence index.', 'convertkit' ),
$this->block->get_title_plural()
);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function get_label() {

return sprintf(
/* translators: %s: block title */
__( 'Insert a %s element into a post', 'convertkit' ),
__( 'Insert %s into a Page, Post or Custom Post', 'convertkit' ),
$this->block->get_title()
);

Expand All @@ -59,9 +59,8 @@ public function get_description() {

return sprintf(
/* translators: 1: block full name e.g. convertkit/form, 2: block title */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

niptick (non-blocking): should this comment be updated like in the other get_description in this PR?

__( 'Inserts a new %1$s (%2$s) element into the given post\'s content. The element can be appended (default), prepended, or positioned relative to an existing element using a zero-based index.', 'convertkit' ),
'convertkit/' . $this->block->get_name(),
$this->block->get_title()
__( 'Inserts a new %s in a Page, Post or Custom Post\'s content. The element can be appended (default), prepended, or inserted relative to an existing element using a zero-based index.', 'convertkit' ),
$this->block->get_title_plural()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (non-blocking): this and other descriptions for tools that work on a single item should probably not use the plural (label looks good)

);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function get_label() {

return sprintf(
/* translators: %s: block title */
__( 'List %s elements in a post', 'convertkit' ),
$this->block->get_title()
__( 'List %s in a Post, Page or Custom Post', 'convertkit' ),
$this->block->get_title_plural()
);

}
Expand All @@ -76,10 +76,9 @@ public function get_label() {
public function get_description() {

return sprintf(
/* translators: 1: block full name e.g. convertkit/form, 2: block title */
__( 'Lists every occurrence of the %1$s (%2$s) element in the given post, including each occurrence\'s zero-based index and current attribute values.', 'convertkit' ),
'convertkit/' . $this->block->get_name(),
$this->block->get_title()
/* translators: Block Name */
__( 'Lists every %s in the given Post, Page or Custom Post, including each occurrence\'s zero-based index and current attribute values.', 'convertkit' ),
$this->block->get_title_plural()
);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function get_label() {

return sprintf(
/* translators: %s: block title */
__( 'Update an existing %s element in a post', 'convertkit' ),
__( 'Update Existing %s in a Page, Post or Custom Post', 'convertkit' ),
$this->block->get_title()
);

Expand All @@ -67,10 +67,9 @@ public function get_label() {
public function get_description() {

return sprintf(
/* translators: 1: block full name e.g. convertkit/form, 2: block title */
__( 'Updates the attributes of a single occurrence of the %1$s (%2$s) element in the given post. By default the provided attributes are merged into the existing attributes.', 'convertkit' ),
'convertkit/' . $this->block->get_name(),
$this->block->get_title()
/* translators: Block Name */
__( 'Updates the attributes of an existing %s in a Page, Post or Custom Post. The provided attributes are merged into the existing attributes.', 'convertkit' ),
$this->block->get_title_plural()
);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ private function get_input_schema_property_type( $field ) {

switch ( $type ) {
case 'resource':
case 'text':
case 'color':
case 'select':
return 'string';

case 'number':
Expand All @@ -174,7 +177,8 @@ private function get_input_schema_property_type( $field ) {
return 'boolean';

default:
return $type;
// Unknown field type — fall back to string.
return 'string';
}

}
Expand Down
Loading