Airship\Cabin\Bridge\Blueprint\Blog::getCategoryInfo PHP Méthode

getCategoryInfo() public méthode

Get a category
public getCategoryInfo ( integer $categoryId ) : array
$categoryId integer
Résultat array
    public function getCategoryInfo(int $categoryId = 0) : array
    {
        $row = $this->db->row('SELECT * FROM hull_blog_categories WHERE categoryid = ?', $categoryId);
        if (empty($row)) {
            return [];
        }
        return $row;
    }

Usage Example

Exemple #1
0
 /**
  * Edit a category
  *
  * @route blog/category/edit/{id}
  * @param string $id
  */
 public function editCategory(string $id = '')
 {
     $id = (int) $id;
     $post = $this->post(new EditCategoryFilter());
     if (!empty($post)) {
         if ($this->blog->updateCategory($id, $post)) {
             \Airship\redirect($this->airship_cabin_prefix . '/blog/category');
         }
     }
     $category = $this->blog->getCategoryInfo($id);
     $this->lens('blog/category_edit', ['active_link' => 'bridge-link-blog-category', 'category' => $category, 'categories' => $this->blog->getCategoryTree(), 'title' => \__('Edit Category "%s"', 'default', Util::noHTML($category['name']))]);
 }