/** * _item_row * * @param EE_Line_Item $line_item * @param array $options * @return mixed */ protected function _item_row(EE_Line_Item $line_item, $options = array()) { $line_item_related_object = $line_item->get_object(); $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null; // start of row $row_class = $options['odd'] ? 'item odd' : 'item'; $html = EEH_HTML::tr('', '', $row_class); //Name Column $name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : ''; //related object scope. $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : ''; $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : ''; $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name(); $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; $name_html .= $line_item->is_taxable() ? ' *' : ''; //maybe preface with icon? $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html; $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; $name_html .= sprintf(_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), '<span class="ee-line-item-related-parent-object">', $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type() : __('Item:', 'event_espresso'), $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name, '</span>'); $html .= EEH_HTML::td($name_html, '', 'jst-left'); //Type Column $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type() . '<br />' : ''; $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; $type_html .= !empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : ''; $html .= EEH_HTML::td($type_html, '', 'jst-left'); //Date column $datetime_content = ''; if ($line_item_related_object instanceof EE_Ticket) { $datetimes = $line_item_related_object->datetimes(); foreach ($datetimes as $datetime) { if ($datetime instanceof EE_Datetime) { $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; } } } $html .= EEH_HTML::td($datetime_content, '', 'jst-left'); //Amount Column if ($line_item->is_percent()) { $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght'); } else { $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); } //finish things off and return $html .= EEH_HTML::trx(); return $html; }