Skip to content

Commit

Permalink
More code exporting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Oct 1, 2024
1 parent 977d854 commit 099ba47
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions components/Migrate-PHP/Migrate-PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ private function migrate_template( $object_id, bool $cleanup ) {
<?php
/**
* Pod Template: {$object->get_label()}
*
* @var Pods \$obj
*/
?>
Expand Down Expand Up @@ -280,18 +282,16 @@ private function migrate_page( $object_id, bool $cleanup ) {

$this->setup_file_path( $file_path );

$precode = $object->get_arg( 'precode' );
$precode = (string) $object->get_arg( 'precode' );

if ( false !== strpos( $precode, '<?' ) && false === strpos( $precode, '?>' ) ) {
$precode .= "\n?>";
}
$contents = <<<PHPTEMPLATE
<?php
/**
* Pod Page Template: {$object->get_label()}
*/
?>
$precode_template = '';
if ( ! empty( $precode ) ) {
$precode_template = <<<PHPTEMPLATE
<?php
/*
Expand All @@ -300,10 +300,19 @@ private function migrate_page( $object_id, bool $cleanup ) {
?>
{$precode}
PHPTEMPLATE;
}
$contents = <<<PHPTEMPLATE
<?php
/*
* PHP code goes below.
/**
* Pod Page Template: {$object->get_label()}
*
* @var Pods \$pods
*/
{$precode_template}
?>
{$object->get_description()}
PHPTEMPLATE;
Expand Down

0 comments on commit 099ba47

Please sign in to comment.