Skip to content

Commit 60d538c

Browse files
set an internal_title for helping with searches
1 parent 0d6b128 commit 60d538c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

classes/Visualizer/Module/Chart.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,22 @@ private function _handleDataAndSettingsPage() {
606606
// save meta data only when it is NOT being canceled.
607607
if ( ! ( isset( $_POST['cancel'] ) && 1 === intval( $_POST['cancel'] ) ) ) {
608608
update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST );
609+
610+
// we will keep a parameter called 'internal_title' that will be set to the given title or, if empty, the chart ID
611+
// this will help in searching with the chart id.
612+
$settings = get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
613+
$title = null;
614+
if ( isset( $settings['title'] ) && ! empty( $settings['title'] ) ) {
615+
$title = $settings['title'];
616+
if ( is_array( $title ) ) {
617+
$title = $settings['title']['text'];
618+
}
619+
}
620+
if ( empty( $title ) ) {
621+
$title = $this->_chart->ID;
622+
}
623+
$settings['internal_title'] = $title;
624+
update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $settings );
609625
}
610626
$render = new Visualizer_Render_Page_Send();
611627
$render->text = sprintf( '[visualizer id="%d"]', $this->_chart->ID );

0 commit comments

Comments
 (0)