Visualforce component used in multiple pages and controllers

You can pass variables from a visualforce page to a component. The problem is that this attribute will be assigned after the call of the controller constructor. But there is a workaround by calling the method you need in the variable setter. For example:

CustomComponent.component

<apex:component extensions="CustomController" allowDML="true">
    <apex:attribute name="IsFromRelatedList" type="Boolean" required="true" assignTo="{!IsFromRelatedList}" description="From where this component is called" />
</apex:component>

VFEdit.page (used in an Edit button override)

<apex:page id="page" docType="html-5.0" standardController="Custom__c" ..>
   <c:customComponent IsFromRelatedList="false" />
</apex:page>

VFNew.page (used in a button from the related list)

<apex:page id="page" docType="html-5.0" standardController="Custom__c" recordSetVar="cItems" ..>
   <c:customComponent IsFromRelatedList="true" />
</apex:page>

Controller class

public with sharing class CustomController{
   public Boolean IsFromRelatedList {get;set{
        this.IsFromRelatedList = value;
        if(value == true){
            //do what you want if the call is from the related list
        }else{
            //do what you want if this is not from the related list
        }
    }}

   public CustomController(){
      System.debug('1');
      init();
   }
}