Convert former embedded PHP code into a custom block module? Had a Drupal site that used the php filter module. After realizing the security risk I started the process of fixing things up.

Currently the last piece of code is a php snippet I embedded into a view to display the input fields of a content type (called post). 

&lt;?php 
  module_load_include('inc', 'node', 'node.pages');
  $node_form = node_add('post');
  print drupal_render($node_form);
  $form['buttons']['submit']['#value'] = t('Save and add new');
?&gt;


This is a view block embedded within a panel. Not 100% sure how to take this and make it a custom module that I suppose cloud be a block for me to embed on the panel page.

Update:
Attempted to make the module using hook_block_configure() but when enabled it is not showing up as a block option for me to embed. 

&lt;?php

/**
 * Implements hook_block_configure().
 */

function hook_block_configure($delta = '') {

  module_load_include('inc', 'node', 'node.pages');
  $node_form = node_add('post');
  print drupal_render($node_form);
  $form['buttons']['submit']['#value'] = t('Save and add new');

}


Is the correct command being used?
I don't really think embedding a node form in a node view is good in terms of performance because the entire node form needs to be rebuilt, and it can interferer caching mechanisms as well. Probably a ctools madal form with Ajax will do the job better. 

You can define blocks in your site using a custom module. Panels will pick them up without any further integration. 

function MYMODULE_block_info() {
  $blocks['MYMODULE_post_node_form'] = array(
    'info' =&gt; t('Add new'),
    'cache' =&gt; DRUPAL_NO_CACHE,
  );

  return $blocks;
}


function MYMODULE_block_view($delta = '') {
  $block = array();

  switch ($delta) {
    case 'MYMODULE_post_node_form':
      module_load_include('inc', 'node', 'node.pages');
      $node_form = node_add('post');
      $node_form['buttons']['submit']['#value'] = t('Save and add new'); 
      $block['content'] = $node_form; // No need to render() here. Will happen automatically.
      break;
  }

  return $block;
}


I'm assuming you know how to create a basic module with an .info file, change "MYMODULE" to the module name of your choice and how to install them. 
If everything went OK, you will see the "Add new" block in admin/structure/blocks page and in "Add content" form in panels.