I am using below code to add attribute in my custom module.
namespace BoostMyShop\Enhancement\Setup;
use Magento\Framework\Module\Setup\Migration;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
/**
* Customer setup factory
*
* @var \Magento\Customer\Setup\CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* Init
*
* @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
*/
public function __construct(\Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory)
{
$this->customerSetupFactory = $customerSetupFactory;
}
/**
* Installs DB schema for a module
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
$entityTypeId = $customerSetup->getEntityTypeId(\Magento\Customer\Model\Customer::ENTITY);
$customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "company_name", array(
"type" => "varchar",
"backend" => "",
"label" => "Company Name",
"input" => "text",
"source" => '',
"visible" => true,
"required" => true,
"default" => "",
"frontend" => "",
"unique" => false,
"note" => "",
"position" => 998,
"is_used_in_grid" => true,
"is_visible_in_grid" => true,
"is_filterable_in_grid" => true,
"is_searchable_in_grid" => true
));
$customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "company_registration", array(
"type" => "varchar",
"backend" => "",
"label" => "Company Registration",
"input" => "text",
"source" => '',
"visible" => true,
"required" => true,
"default" => "",
"frontend" => "",
"unique" => false,
"note" => "",
"position" => 999,
"is_used_in_grid" => true,
"is_visible_in_grid" => true,
"is_filterable_in_grid" => true,
"is_searchable_in_grid" => true
));
$regulation = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "company_name");
$regulation = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'company_name');
$used_in_forms[]="customer_account_edit";
$used_in_forms[] = "adminhtml_customer";
$regulation->setData("used_in_forms", $used_in_forms)
->setData("is_used_for_customer_segment", true)
->setData("is_system", 0)
->setData("is_user_defined", 1)
->setData("is_visible", 1)
->setData("sort_order", 100);
$regulation->save();
$installer->endSetup();
}
}
Using above code attribute is showing in admin grid , admin customer edit page. But I want them in Edit Account Information page.
Thanks in advance