How many different types of Eav Entity Types are available in Magento 2?

Magento supports Out-of-the-box Eav entity types for different Entity types.

You can check the list of Eav Entity Type from the eav_entity_type database table.

Out of the box Entity type code supported by Magento,

entity_type_code
1. customer
2. customer_address
3. catalog_category
4. catalog_product
5. sales_order
6. invoice
7. creditmemo
8. shipment
9. rma_item (Magento Commerce)
10.gene_bluefoot_entity (Magento Commerce if Bluefoot is installed)

All of the above Eav Entity Types are available with Magento 2.

How to Load attribute data by attribute code in Magento 2?

We can get attribute data by attribute code by just passing the attribute code in Magento 2.

We have taken entity_type_code  value as Catalog_Product  for a demo in the below code, You can get any entity_type_code as per your requirement.

<?php

public function __construct(
    \Magento\Eav\Model\Entity\Attribute $entityAttribute
) {
    $this->entityAttribute = $entityAttribute;
}

/**
* Load attribute data by code
* @return  \Magento\Eav\Model\Entity\Attribute
*/
public function getAttributeInfo($attributeCode)
{
    return $this->entityAttribute->loadByCode('catalog_product', $attributeCode);
}

Now, Call getAttributeInfo() function from template,

$attributInfo = $this->getAttributeInfo('color');
echo '<pre>';print_r($attributInfo->debug());

The result will be like the below array for color product attributes,

Array
(
    [attribute_id] => 93
    [entity_type_id] => 4
    [attribute_code] => color
    [attribute_model] => Magento\Catalog\Model\ResourceModel\Eav\Attribute
    [backend_model] => Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend
    [backend_type] => int
    [frontend_input] => select
    [frontend_label] => Color
    [is_required] => 0
    [is_user_defined] => 1
    [is_unique] => 0
    [is_global] => 1
    [is_visible] => 1
    [is_searchable] => 1
    [is_filterable] => 1
    [is_comparable] => 1
    [is_visible_on_front] => 0
    [is_html_allowed_on_front] => 0
    [is_used_for_price_rules] => 0
    [is_filterable_in_search] => 1
    [used_in_product_listing] => 0
    [used_for_sort_by] => 0
    [apply_to] => simple,virtual,configurable
    [is_visible_in_advanced_search] => 0
    [position] => 0
    [is_wysiwyg_enabled] => 0
    [is_used_for_promo_rules] => 0
    [is_required_in_admin_store] => 0
    [is_used_in_grid] => 1
    [is_visible_in_grid] => 0
    [is_filterable_in_grid] => 1
    [search_weight] => 1
    [additional_data] => {"update_product_preview_image":"0","use_product_image_for_swatch":"0","swatch_input_type":"visual"}
)

How to get backend Url in Magento 2?

It’s quite easy to fetch Base URL for an Admin panel/Backend in Magento 2 using Backend module Url Class.

Back end Url have base store Url plus admin URI name. like {BASE_URL}/admin/

You can get Magento2 backend URL by just below way,

public function __construct(
    \Magento\Backend\Model\Url $backendUrlManager
) {
    $this->backendUrlManager  = $backendUrlManager;
}

public function getBackendUrl()
{
    return $this->backendUrlManager->getUrl('sales/order/view', ['param1' => 'param1']);
}

We have passed Sales/order/view action with a query string as param1 in URL.

Get URL from an adminhtml template or PHP file,
echo $this->getBackendUrl();