覆盖Class Twig Timely all-in-one-event-calendar

时间:2015-04-29 13:47:11

标签: php wordpress calendar wordpress-plugin twig

我试图覆盖在Timely的All-In-One-Event-Calendar中显示类别的方式。此日历使用twig显示所有类别和字母列表。我需要按父ID对列表进行分组。

位置/all-in-on-event-calendar/app/view/calendar/taxonomy.php是:

/**
 * Creates the html for categories filter
 *
 * @param array $view_args
 * @return string
 */
public function get_html_for_categories( array $view_args ) {
    return $this->_get_html_for_taxonomy( $view_args );
}

/**
 * Generates the HTML for a taxonomy selector.
 *
 * @param array $view_args Arguments to the parent view
 * @param bool  $tag       whether it's tags or categories.
 *
 * @return string          Markup for categories selector
 */
protected function _get_html_for_taxonomy( $view_args, $tag = false ) {
    $taxonomy_name      = 'events_categories';
    $type               = 'category';
    $type_for_filter    = 'cat_ids';
    $type_for_view_args = 'categories';

    .... DOES STUFF THAT I WANT TO OVERRIDE....

    .... TWIG LOADER THAT FEEDS THE TWIG TEMPLATE....
    $loader = $this->_registry->get( 'theme.loader' );
    return $loader->get_file( $type_for_view_args . '.twig', $args, false )
        ->get_content();
}

然后在/all-in-on-event-calendar/public/themes-ai1ec/mytemplate/categories.twig中:

<li class="ai1ec-dropdown ai1ec-category-filter
{% if selected_cat_ids is not empty %}ai1ec-active{% endif %}">
<a class="ai1ec-dropdown-toggle" data-toggle="ai1ec-dropdown">
    <i class="ai1ec-fa ai1ec-fa-folder-open"></i>
    <span class="ai1ec-clear-filter ai1ec-tooltip-trigger"
        data-href="{{ clear_filter }}"
        {{ data_type | raw }}
        title="{{ text_clear_category_filter }}">
        <i class="ai1ec-fa ai1ec-fa-times-circle"></i>
    </span>
    {{ text_categories }}
 ..... cut off rest .....

基本上 - 我想知道如何在我的自定义模板中正确覆盖get_html_for_categories,以便它为树枝模板提供信息。我知道我可以修改/all-in-on-event-calendar/app/view/calendar/taxonomy.php但这些更改只会在每次更新时重写。 functions.php位于/all-in-on-event-calendar/public/themes-ai1ec/mytemplate/functions.php,但似乎无法覆盖该类。有什么建议?谢谢!

0 个答案:

没有答案