victorjonsson / Arlima

Article List Manager - Wordpress plugin suitable for online newspapers that's in need of a fully customizable front page
28 stars 16 forks source link

Change the file-include implementation #63

Open victorjonsson opened 9 years ago

victorjonsson commented 9 years ago

Current implementation: https://github.com/victorjonsson/Arlima/wiki/File-includes

Suggested API:

arlima_article_function( $arr=array() )

// Using a file as callback
arlima_article_function(array(
  'label' => 'Label for this function',
  'description' => 'Description of this function',
  'file' => 'path/to/some/file.php',
  'args' => array(
    'arg1' => 'default value',
    'arg2' => 'other default value'
  )
));

// Using an anonymous function as callback
arlima_article_function(array(
  'label' => 'Label...',
  'slug' => 'some-function-slug'
  'callback' => function($args, $article, $list) {
    return 'the content...';
  },
  'args' => array(
    'arg1' => 'default value',
    'arg2' => 'other default value'
  )
));

Maybe there's some better name than article_function?