Ejemplo n.º 1
0
 public function __construct(Wordpress $wp)
 {
     $this->wp = $wp;
     $wp->addAction(sprintf('%s_add_form_fields', Types::PRODUCT_CATEGORY), array($this, 'showThumbnail'));
     $wp->addAction(sprintf('%s_edit_form_fields', Types::PRODUCT_CATEGORY), array($this, 'showThumbnail'));
     $wp->addAction('created_term', array($this, 'saveThumbnail'), 10, 3);
     $wp->addAction('edit_term', array($this, 'saveThumbnail'), 10, 3);
     $wp->addAction(sprintf('delete_%s', Types::PRODUCT_CATEGORY), array($this, 'delete'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         $wp->wpEnqueueMedia();
         Scripts::add('jigoshop.admin.product_categories', \JigoshopInit::getUrl() . '/assets/js/admin/product_categories.js', array('jquery', 'jigoshop.media'));
         Scripts::localize('jigoshop.admin.product_categories', 'jigoshop_admin_product_categories', array('category_name' => Types::PRODUCT_CATEGORY, 'placeholder' => \JigoshopInit::getUrl() . '/assets/images/placeholder.png'));
         $wp->doAction('jigoshop\\admin\\product_categories\\assets', $wp);
     });
 }
Ejemplo n.º 2
0
 /**
  * @param Wordpress $wp
  */
 public function addAdminAssets(Wordpress $wp)
 {
     $wp->wpEnqueueMedia();
     Styles::add('jigoshop.admin.product.variable', \JigoshopInit::getUrl() . '/assets/css/admin/product/variable.css');
     Scripts::add('jigoshop.admin.product.variable', \JigoshopInit::getUrl() . '/assets/js/admin/product/variable.js', array('jquery', 'jigoshop.media'));
     Scripts::localize('jigoshop.admin.product.variable', 'jigoshop_admin_product_variable', array('i18n' => array('confirm_remove' => __('Are you sure?', 'jigoshop'), 'variation_removed' => __('Variation successfully removed.', 'jigoshop'), 'saved' => __('Variation saved.', 'jigoshop'))));
 }