Skip to content

Instantly share code, notes, and snippets.

@manojiksula
manojiksula / excel_to_array.php
Created July 10, 2019 14:04 — forked from lastguest/excel_to_array.php
Read an Excel sheet as PHP array. (Needs PHPExcel)
<?php
// Needs PHPExcel
// https://phpexcel.codeplex.com/
function excel_to_array($inputFileName,$row_callback=null){
if (!class_exists('PHPExcel')) return false;
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
@danreb
danreb / template.php
Created November 6, 2012 03:48
Change Add to Cart button label in Drupal Commerce for specific product.
<?php
/**
* Implements hook_form_alter
*
*/
function arma_form_alter(&$form, $form_state, $form_id) {
if ($form_id === 'commerce_cart_add_to_cart_form_2' || $form_id === 'commerce_cart_add_to_cart_form_1') {
$form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value'] = t('Buy Corporate Membership');
}