texts: Single vs Multi-step Form - Hundreds of fields

texts:
I'm looking into enhancing an existing entry form on a Drupal 7 site.  We currently are using a single content type and the field API to store all of the data. It already has 46 fields on it, but the business wants hundreds more.

I understand the limitations of MySQL only allowing 61 joins, so I assume that adding 100+ new fields to a single content type using the Field API is out of the question because MySQL will probably crash trying to load the content. (Prove me wrong if you know otherwise)

So my question is, should I create multiple content types which break out the form into a multi-step process, or is there some way to group data from multiple fields into a single table? (I'm thinking of field collections or something similar)

I feel like I have three options:

Field API:

Break out the fields across multiple content types
Group multiple fields into a single table (field collections? field groups?)

Form API:

Implement custom fields and store the data in a custom table

Contrib Module (such as Webform)

Using the form API and custom fields is not completely out of the question, but I'd like to be able to use the Field API if possible since the original form is already using it.  I'm also not opposed to switching to webforms or some other method that is better suited for this purpose.


texts:
I have a content type 'Member' with a field referring to taxonomy term called 'Member role' which is a multi value field. Each member may have up to 3 member roles.

I have created a view to display members which sorted by taxonomy term weight with reference to taxonomy field. But the problem is each member repeats 3 times in the view result page.

My question is how to remove duplicates and only sort by last value in the multi value field(Member role).


texts: In Drupal 8.2.x there is the new migration UI tool. I've enabled it, but I can't find any link going to any UI page. Back in Drupal 7 when you enabled a module, it would have a configure link next to the module name in the modules page, but Drupal 8 doesn't. How would one find these configure links to the module pages?


texts: Where is body field label stored in database

texts:
Due some caching problems I can't immediately change field label via /admin/structure/types/manage/page/fields. So I thought that I will able to do it from mysql but I can't find it. Any help?

Please note, that I have developement state here /admin/config/development/performance - no caching at all, no compressing


texts: Can't uninstall module that depends on custom field type in use

texts:
Drupal 8

Using Yoast, I've removed it from all my content types but I can't uninstall because it says --> The Yoast SEO status & focused keywords field type is used in the following field: taxonomy_term.field_yoast_seo, which I did not create nor is it visible via Structure > Taxonomy.

Looking into the DB, there's over 51 matches for 'field_yoast_seo', but I can see where it is created:

It's a table. I don't know if I can just go ahead and delete it without it backfiring on me. Has anyone tried it?


texts:
I have a content type A, which contains an entity reference field. That field references a content type B.
I have create automatic URL paths for both content types.

When I create a new node of type A, in the same page I can add a node of type B since it's referenced. The issue is URL alias for node type B won't create. If I want that pattern for B to work I have to create that node independently (not 'inside' of node type A) or create it 'inside' A and after edit it. It will work in that case, but I'd like not to have to edit every node of type B, and just create them once and have its URL working.

I have found similar threads but nothing exactly like this. I'd appreciate any help.

Thanks!


texts: Drupal 7 with Display Suite and Apache SOLR search environments

texts:
I have the magnificent Display Suite working for search results but I can't for the life of me figure out how to use it to modify a search environment defined on admin/config/search/apachesolr/search-pages.  Please can someone explain how do I use DS to change the display?

Outstanding.  After a weekend of searching it turns out this is a known bug (http://drupal.org/node/1166114) which may be fixed in Drupal 8.

Does anyone know the best method for encouraging it to be fixed quickly in D7?  I'd be prepared to contribute to a bounty.


texts: How can I programmatically alter Webform "To Email Address"?

texts:
I want to change email addresses based on postal codes entered by users.
My code looks like below.
function my_webform_tracker_webform_submission_render_alter(&$renderable) {
  $node_id = (int)$renderable['#node']->nid;
  if ($node_id == 257) {
    $postal_code = (int)$renderable['#submission']->data[5][0];
    if($postal_code >= 14000 && $postal_code <= 14990) {
      $renderable['#email'][email] = "thisemailid@mydomain.com";
      $renderable['#node']->webform['emails'][1]['email'] = "thisemailid@mydomain.com";
      $renderable['#node']->webform['emails'][2]['email'] = "thisemailid@mydomain.com";
      //print "<pre>"; print_r($renderable); exit;
    }
  }
}

I tried a lot but the email id seems to be not changed. Please help me figure this out.


texts: Restrict users to view custom form(s) without complete other formalities

texts:
I wrote 3 custom forms using hook_menu() for resetting password. All forms have these functionalities.

Form # 1. On submit, sends OTP (code) after entering mobile number and redirect to form # 2

From # 2. On submit, validate OTP and redirect to form # 3

From # 3. The last form where user can enter password and confirm password and submit.

How to restrict user from accessing form#2 without submit form#1?

                        AND

How to restrict user from accessing form#3 without submit form#2?


texts: TemporaryStreamWrapper error during installation

texts:
In continuation to my previous question https://drupal.stackexchange.com/questions/208245/openatrium-installation-profile-error

I have another problem in the very next step i.e. during Site Configuration.

Firstly the theme seems to have broken because CSS is not being applied.
Secondly, I'm getting the error message.

"Warning: file_put_contents(temporary://fil3BF3.tmp): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1936 of \includes\file.inc).

•The file could not be created."

I understand from some other posts that this is due to missing permissions on "sites/default/files" folder. But this folder is created on the fly during installation how do we give access to it.
In addition, I believe another possible cause can be due to permissions to "tmp" folder. Most of the other posts mention changing that path in "Admin -> configuration" somewhere, but for that OpenAtrium needs to be completely installed. Where can I change the path for "tmp" file through file system.

Appreciate a reply.


texts:
I am trying to update a value during the validate phase of a node-form, i.e. if the custom validation error is fired, just empty one of the fields.

for the last 30 hours I am trying to make sense of the drupal api, but I am giving up. I just do not seem to get the idea what the different values mean.

the function is: form_set_value($element, $value, &$form_state)

now i understand that the last value is simply the $form_state, that I am having through the validate function. but what about $element and $value?

I was trying a lot and apparently the desired value resides in $form['field_name']['und'][0]['value']['#value'] and only there.

but when I am trying form_set_value($form['field_name']['und'][0]['value']['#value'],'foo',$form_state) it raises

    Recoverable fatal error: Argument 2 passed to drupal_array_set_nested_value() must be an array, string given, called in /includes/form.inc on line 2436 and defined in drupal_array_set_nested_value()

and when I am trying:

    $newvalue = $form['field_name']['und'][0]['value'];
    $newvalue['#value']='foo';
    form_set_value($form['field_name']['und'][0]['value'],$newvalue,$form_state);

it raises:

    Warning: mb_strlen() expects parameter 1 to be string, array given in drupal_strlen()

Thanks for any help!

[EDIT]

My complete function is:

    function hook_node_validate($node,$form,&$form_state) {
      if(fancy_stuff){
        form_set_value();
        form_set_error();
      }
    }

[EDIT2]

    //calls when node is being created
    function eventcheck_node_validate($node,$form,&$form_state) {
      //checks if the node type is applicable
      if($node -> type=='article') {
        //checks if field 'field_event_choose' AND either 'field_event_title'
        //or 'field_event' is supplied, if so, fire form_set_value() and form_set_error()
        if ((array_key_exists('endpoints',$node -> field_event_choose['und'][0])) &&
        (($node -> field_event_title['und'][0]['value']<>'') || (isset($node ->
        field_event['und'][0]['value'])))) {

          //fire away
          $form_set_value(???);
          $form_set_error('event_checker_group',t('sorry blabla'));

        }
      }
    }

I hope that helps.


texts: a lot of template (.tpl.php) files, is it good or not?

texts:
I have used about 110 template files (tpl.php) in my theme, will that slow my drupal site?

I mean:

  more template files == consume Server performance.


texts: Can't edit media Image from within node edit

texts:
I'm using Media and the Media Library (yes I know this is experimental). And all of the sudden I'm not able to edit my added image when I'm editing a node. In an earlier stage of the website I was able to edit the image by clicking the name. The name was blue (a link).

But now the name is black.

Even though I'm the admin I checked the permissions but all looks fine. And when I go to my Media Library I am able to change the Images with the name link.

I'm new to Media and the Media Library so I was wondering if there is a setting I've missed? Or if there is a common bug I couldn't find online. Hope someone can help me figuring out what the problem is.

Thanks in advance


texts: Place custom Block, return Internal Server Error

texts:
I create a Block Plugin in a module,
it be showing the available blocks but when I try to place the block, it returns in the browser console the follow error:

  AjaxError:
  An AJAX HTTP error occurred.
  HTTP-resultaatcode: 500
  Debug informatie volgt.
  Pad: /admin/structure/block/add/hello_block/bartik?region=footer_fourth
  Statustekst: Internal Server Error
  Antwoordtekst:

I have place the code on the follow place:
DrupalRoot/modules/pagebuilder/src/Plugin/Block/testblock.php

<?php

/**
 * @file
 * Contains \Drupal\pagebuilder\Plugin\Block\testblock.
 */
namespace Drupal\pagebuilder\Plugin\Block
use Drupal\Core\Block\BlockBase;

/**
 * Provides a 'Hello' Block
 *
 * @Block(
 *   id = "hello_block",
 *   admin_label = @Translation("Hello block"),
 * )
 */
class testblock extends BlockBase {

    /**
     * {@inheritdoc}
     */
    public function build() {
        return array(
            '#markup' => $this->t('Hello, World!'),
        );
    }
}
?>

How can i fix this problem?


texts: combine several exposed filters into one exposed (search) form?

texts:
Is there an easy way to combine two or more exposed filters into one shared exposed form? So that I don't have to have several search fields for each and every field that I want to filter.

Is this possible? Any modules that does this? I am using the Better Exposed Filters module.

Thanks in advance


texts: In views formatted as table, columns with taxonomy term fields are sorted according to term ID, not label

texts:
In Drupal 8 I have View formatted as table, where user can click to any column header to sort displayed records according to the given field. This works well for numbers (ascending/descending), as well as for plain text (ascending/descending for title or any other text values), records are then sorted correctly alphabetically. But this does not work for taxonomy terms - they are sorted according to taxonomy term ID and not alphabetically according to label.

I.e. I wish to display in the table column with a taxonomy term (only one value is allowed per node) and be able to sort the table alphabetically.

In my use case I have records about plant specimens containing plenty of fields, including e.g. species or life form. These are taxonomy terms. I'm displaying the specimen records in table filterable according to various criteria, e.g. various traits. The table is also sortable according to any column, e.g. species, but in this particular case, it is sorted according to taxonomy term ID and not naturally by label.

I found several answers to similar problems, but nothing exactly fitting my problem. Views Natural Sort module might also help, but its development status is not very promising.


texts: How do you handle static HTML forms saved in a "Basic Page" in Drupal 7?

texts:
I am a Drupal newbie and have been asked to help with some issues on a Drupal implementation. I have been asked to handle HTML forms that have already been designed and saved in "Basic Page" as either "full html" or php.

I have googled but could not find an references to such form handling. Almost every piece of code I have seen generates forms using Drupal Form API. There is enough documentation to work with forms generated using the Form API.

I would like to know if there is a way to handle these static(ally generated) forms and if so how.


texts: Setting values for custom display fields in Views

texts:
thanks in advance for your help with this.

Firstly, the Basic Page type of my drupal build has a Title (as per usual) and a Subtitle custom field. The Title and Subtitle are then displayed in a header when viewing the node.

I then have a View which is producing a page displaying a list of Employees from the Employee content type. The Employee content type does not have the subtitle field.
When the view is displayed it uses the standard page.tpl.php which will display the subtitle field if it exists.

Since the View is displaying a page, it is not bound to any specific Basic Page node so there is no subtitle to pull in to the View.

Is it possible to add the subtitle variable into this View so I can fill it with a custom piece of text and have it display on the View page.

Thanks again.

EDIT: Updated text to clear up confusion


texts: view content by two taxonomy terms from two vocabulary

texts:
I have a content tagged by two taxonomy vocabulary ( location and category)

How can I let the user select the location then select the category, the view (or panel) will show the contents tagged with both terms

with love


texts: Custom Webform Email Response to two different recipients

texts: When a customer fills out a webform, I create a customized email response by creating a custom email template (e.g. webform-mail-26.tpl.php). I needed to create this so that the customer could see exactly what options he chose and not options he did not. The email also has some nice instructions. But I also need to send the admin an email with all the information that was in the form. How can I send two emails, one to the customer and one to the admin, but have each email display different content?


texts:
How do I load Ajax pager?
My code in custom module

function organization_news_page(){
if(menu_get_object()){
$node = menu_get_object();
$query = db_select('node', 'n')
    ->fields('n', array('nid', 'uid', 'type'))
    ->condition('n.status', NODE_PUBLISHED)
    ->condition('n.type', 'news', '=')
    ->extend('PagerDefault')
    ->limit(10)
    ->orderBy('n.created', 'DESC');
$result = $query->execute();
$output = '';
    foreach($result as $value){
      if($value->uid == $node->uid){
        $node_news = node_load($value->nid);
        $image = theme('image_style', array('style_name' => '165x103', 'path' => $node_news->field_image['und'][0]['uri']));
        $body = render(field_view_field('node', $node_news, 'body', array('label' => 'hidden', 'type' => 'text_summary_or_trimmed', 'settings' => array('trim_length' => 200))));
        $output .= '
'.$image.'';
        $output .= ''.format_date($node_news->created, 'custom', 'j.m.Y').'';
        $output .= ''.$node_news->title.'';
        $output .= $body;
        $output .= l('подробнее...', 'node/'.$node_news->nid, array('attributes' => array('class' => array('read-more-link'))));
        $output .= '
';
    }
  }
  $output .= theme('pager', array('element' => 1, 'quantity' => 9));
  return $output;

 }
}


texts: Display root terms based on child in a view

texts:
I've a city vocabulary (see example below) which I import from 3-th party service. Each city may be spelled differently (either with wrong spelling or with special characters). In my example let's assume that TEST is a different variation of Oslo city.

These cities are already used in Content Type 'Person'. I built a view that display Persons with a category City. Everything works well and my view looks like this:

Now I need to substitute/replace TEST with Oslo (as it is different spelling of Oslo city).
On a view I expect to not see TEST and Oslo must get +1 as a counter.

  Oslo (34)

UPDATE
Here are my settings for the view.

What should I do in order to achieve that? Thanks.


texts: Unable to fix my site after Commerce Promotion was enabled (no Commerce Cart enabled)

texts:
I installed the sub module Commerce Promotion and my Drupal 9 site crashed with the following message, plus debugging code:
The website encountered an unexpected error. Please try again later.
Error: Class 'Drupal\commerce_cart\Event\CartEvents' not found in Drupal\commerce_promotion\EventSubscriber\CartEventSubscriber::getSubscribedEvents() (line 16 of /var/www/html/drupal9test/modules/contrib/commerce/modules/promotion/src/EventSubscriber/CartEventSubscriber.php).

Drupal\commerce_promotion\EventSubscriber\CartEventSubscriber::getSubscribedEvents() (Line: 37)
Drupal\Core\DependencyInjection\Compiler\RegisterEventSubscribersPass->process() (Line: 94)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() (Line: 762)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1293)
Drupal\Core\DrupalKernel->compileContainer() (Line: 898)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 471)
Drupal\Core\DrupalKernel->boot() (Line: 705)
Drupal\Core\DrupalKernel->handle() (Line: 19)

I was able to find in Issues for Drupal Commerce the reason of my site crash, I enabled sub module Commerce Promotion without enabling Commerce Cart sub module.
I added the commit at the end of that post but my site is not fixed. Any suggestion to bring back my site?


texts: How to show only oldest and newest node in Drupal views?

texts:
I want to create a view that only shows the oldest and newest node of a certain content type what is the easiest way to do this?

Thanks


texts: How can I show only first level terms on a dropdown taxonomy exposed filter?

texts:
I have a 2 level taxonomy tree: Countries and cities. I also have a view of content, all of which are marked by first level terms (countries) of that vocabulary.

My taxonomy tree is like that:

Country 1

City 1
City 2
City 3

Country 2

City 4
City 5

In an exposed filter over the view, I want to show only the first level terms (countries) as options. Is it possible?


texts: Drupal Commerce Hook - Extra validation before adding to cart

texts:
I was looking for a hook that will fire after a user hits the add to cart button.
The commerce api isn't very clear about this.

What I'm trying to is:
Add an extra validation for a customized product (date field).
So basically I want to interrupt the adding to the cart process and proceed if validation is ok, and lead the user back if not.

Thanks!


texts: How can i display Facebook profile information like First name, Lastname, address. I am using Drupal for Facebook module in login with facebook a/c in my drupal web site.


texts: How do I control which tabs a block is displayed in?

texts:
Drupal 8.8.1 with commerce 2 installed.

Goal is to make better use of the ‘logged-in user’ landing page(My Account) by adding blocks of useful content.

Blocks created using the UI as well as coded blocks, which are placed into the Content region via structure>block layout>place block, all show up in the My Account user landing page, no problem.

However, the blocks also show up in each of the tabs added by commerce 2, eg Payment Methods and Orders(a list of the logged-in user’s orders), and any additional tabs(My New Tab) which I add from code. (So, it’s not a commerce2 issue).

In block layout, I have set Role Restriction to Authenticated Users, and Page Restriction is /user/* .

So, I’m obviously missing something about how to constrain the display of blocks in tabs.

How do I constrain my blocks display to only show up as required on a subset of the tabs on the 'My Account' user landing page?

Thanks.


texts: can I create a view of items from my menus

texts:
Is it possible to create a view (listing) from a menu ?

I'm trying to find tutorials on using menu_views or maixmenu but i'm not having any luck.


texts: Replace a word in a custom block or paragraph with a token related to a content type field value

texts:
I have a content type with a mix of paragraphs and custom blocks.
Most custom blocks (content) are the same on all pages except for one word that needs to be replaced by an other one.
I would like to replace that word with an other one related to a field on the content type page.
I thought it could be done with Token Filter (https://www.drupal.org/project/token_filter) but that is not an option.
EDIT 2: explain with example
I have a content type 'CMS page'. It has a field 'field_brand_name'. This field is used to replace a string in paragraphs or custom blocks that exists on the content type page.
If I create a page for Magento and a page for Drupal and a page for WordPress. The only that needs to be replaced is the brand name in the text (Magento, Drupal or WordPress) on all custom blocks or paragraphs that I have used on that specific CMS page ... That could be resolved by a Token if there was a context for it, but there is no ... so the token is not replaced. Is that clear enough?


texts: Which hook to use to reorder multi-value field values before saving content

texts:
I have a multi-value field added to my content type. It is actually a field collection.

The users can add unlimited items to this field, and rearrange the items using Drupal's drag-and-drop utility.

However, I want to add some custom logic to the arrangement of field values according to the content.

Which hook should I use, to modify the arrangement of field values before the node saved into the database.

For example, I have the following structure:

My Content Type
|
|-- Field Collection Field // unlimited values
    |
    |-- Name // Text field
    |-- Surname // Text field
    |-- Company // Select list

Let's say a user created a content with the following values:

John - Doe - ACME
Jane - Doe - Ace
Bob - X - ACME
Fred - Something - Ace

I want to sort them with a custom logic in a hook, so that they are arranged like that:

Bob - X - ACME
John - Doe - ACME
Fred - Something - Ace
Jane - Doe - Ace

My question is NOT how to write the logic, BUT which hook to use to modify the arrangements so that I can put my function into it.


texts: Is there any way to export data to CSV file and then import updated data?

texts:
I have a website I started to build couple years ago. But the website itself grew up to something bigger, with more fields and details - and old data are missing these. E.g., recently added Long./Lat. fields but old content doesn’t have them. So I wonder if it’s possible (and what module) to export all data into csv file, update it (I think it's much easier than open one by one node) and than import the updated data? Or something like that.

Thanks for any help.


texts:
I am trying to build my own content administration page and I want to use default drupal node/add page (that one with list of content types available to user) inside view. So far I have made view header with PHP:

<?php
    module_load_include('inc', 'node', 'node.pages');
    $node_page = node_add_page();
    print render($node_page);
?>

but it just displays info that I don't have any content types created (I have of course).

core of the poodle: code acts like user doesnt have permissions to create any content at all

Any idea how to solve this, or where is the problem?


texts: Farbtastic color picker to change the background color of text field input?

texts:
I have taken this JS from the field_example module. I am attaching it to a form textfield element so that when a user brings focus to it the Farbtastic color picker widget pops up and allows the user to populate the field with the chosen hexadecimal color code. It works as expected. I was also expecting the background of the field to dynamically match the chosen color like this. However, it does not. In the linked example the text also turns black/white depending on the chosen color. This feature is also present in the color module.

I've tried adding to the code below, but nothing I try works. How can I adapt the JS below to achieve this? Thanks.

JS

/**
 * @file
 * Farbtastic color picker.
 */

/**
 * Show farbtastic colorpicker widget.
 */
(function ($) {
  Drupal.behaviors.my_color_picker = {
    attach: function(context) {

      $(".edit-my-color-picker").live("focus", function(event) {
        var edit_field = this;
        var picker = $(this).closest('div').parent().find(".my-color-picker");

        // Hide all color pickers except this one.
        $(".my-color-picker").hide();
        $(picker).show();
        $.farbtastic(picker, function(color) {
          edit_field.value = color;
        }).setColor(edit_field.value);
      });

    }
  }
})(jQuery);

Form element

'color' => array(
  '#type' => 'textfield',
  '#title' => t('Color'),
  '#size' => 8,
  '#suffix' => '

',
  '#attributes' => array(
    'class' => array(
      'edit-my-color-picker',
    ),
  ),
  '#attached' => array(
    'library' => array(
      array(
        'system',
        'farbtastic',
      ),
    ),
    'js' => array(
      drupal_get_path('module', 'my_module ') . '/color-picker.js',
    ),
  ),
),


texts:
How do I create a tab in the admin page using a custom module?
The files defining the routes, links and task are the following.
cst_core.routing.yml
cst.admin:
  path: '/admin/MyCustomModule'
  defaults:
    _controller: '\Drupal\cst_core\Controller\CstController::content'
    link_id: 'cst.admin'
    _title: 'MyCustomModule Management'
  requirements:
    _permission: 'cst admin'

cst.admin_menu:
  path: '/admin/MyCustomModule/menu-mgmt'
  defaults:
    _controller: '\Drupal\cst_core\Controller\CstController::content'
    link_id: 'cst.admin_menu'
    _title: 'MyCustomModule Menu Management'
  requirements:
    _permission: 'cst menu'

cst.admin_menu_menu:
  path: '/admin/MyCustomModule/menu-mgmt/menu'
  defaults:
    _controller: '\Drupal\cst_core\Controller\CstController::content'
    link_id: 'cst.admin_menu_menu'
    _title: 'MyCustomModule Menu Management'
  requirements:
    _permission: 'cst menu'

cst.admin_menu_menu_taba:
  path: '/admin/MyCustomModule/menu-mgmt/menu/taba'
  defaults:
    _controller: '\Drupal\arm_core\Controller\CstController::content'
    link_id: 'cst.admin_menu_menu_taba'
    _title: 'MyCustomModule Menu Management tabs'
  requirements:
    _permission: 'cst menu'

cst_core.links.menu.yml
cst.admin:
title: 'MyCustomModule'
description: 'MyCustomModule System'
parent: system.admin
route_name: cst.admin
weight: -20

cst.admin_menu:
title: 'Menu'
description: 'Menu Management.'
parent: cst.admin
route_name: cst.admin_menu
weight: 0

cst.admin_menu_menu:
title: 'Menu'
description: 'Menus.'
parent: cst.admin_menu
route_name: cst.admin_menu_menu
weight: 0

cst_core.links.task.yml
cst.admin_menu_menu_taba:
route_name: cst.admin_menu_menu_taba
title: 'tab-menu A'
base_route: cst.admin_menu_menu

With this, I should have:
-- MyCustomModule
--- Menu Management
---- Menu
+++++ tab-menu A (as a tab) --> but this didn't happend T_T
something like this:


texts: Exposed form for contextual filters when using non-taxonomy filters?

texts:
I have a View with some contextual filters which works great. I also need to provide my users with some way to change the filters once they're on the page.

I've tried using exposed filters but I'd rather use path arguments over query string parameters and there is the conflicting issue between exposed filters and contextual filters which the Views Filter Harmonizer module address but in my case this doesn't work as I'm using some non-taxonomy filters.

So basically what I'd like to do is have a form which allows users to select values which could be passed as contextual filters.

Any help/guidance?


texts: I am new to Drupal and using Drupal7.23 in windows7 with XAMPP installed. While I am creating any content I cannot find "PHP type" in the Data Formats. Kindly tell how to add PHP type in Data Format, as I need to add PHP to the content.


texts: CCK Filefield source->IMCE No option to browse server unless UID1

texts:
I'm using a content type 'image' that uses CCK and filefield sources to browse and upload images.

When logged in as UID1, I'll get an option above the upload field to switch between 'Upload' and 'File Browser'. My problem is that I don't get that for all other users...

I've gone through the permissions and everything else I can think of and I just can't seem to get these options to appear. Any ideas? Probably something really simple I'm missing (it's been a long day....)   :)


texts:
I added the field_tags to my view.

Now I want to add a the tag name as a class name, so I can colour each tag differently.

ex:

tag1

tag2

tag3

Unfortunately, unchecking display all values in same row is not an option for me since I need to limit the view to 4 results.

Therefore, somehow I need to be able to loop through them and attach each of them the tag name as a class name.

How can I achieve this?


texts: ABT term reference field hidden in Node View

texts:
I am using "Access by Term" configuration to control VIEW and UPDATE access for a content type with a Term Reference field in the content type. See screenshot.

But setting this configuration hides the term ref field in Node View.

How do I fix this?

screenshot of the term ref ABT config fieldset:


texts: How do customize settings.php during installation profile

texts:
I'm creating an installation profile for my current company internal project.

During the installation process, one of the custom modules crashes during init(), since it tries to use one global variable defined on settings.php (that's current default behavior of the module)

Using system_form_install_settings_form_alter() I changed the settings form, by adding one input textfield for user's input, and on submit the value is appended to settings.php, but settings.php is rewrited before profile installation starts.

There is any way to prevent cleanup of settings.php by the installation process?


texts:
I have installed ckeditor module for drupal 7.
Whenever any drupal form loads up, it comes up with yellow ckeditor buttons.
I have checked the configuration page to hide the yellow background of ckeditor ,but there's ain't any settings.

So how can I hide this yellow background color. Is this CKEDITOR theme or just configurable?
Has anyone experienced this issue?


texts:
I am developing an events module for an Alumni Website.

In there, have 2 selects -

Select 1 - is to select a batch (that is year of passing ex. 1994, 1995, 1996 etc)

Select 2 - Is the Improved Multiselect using the Module - https://www.drupal.org/project/improved_multi_select

OnChange of Select 1, Select 2 is populated with all the users of that batch. This logic is working good.

But, when I change the batch the selected users are not saved.

Say suppose, I select 1994 batch, Out of the 100 Ex-Students I have selected 2, now I need 1 ex-student from 2000 batch, so I change the batch but the 2 selected students are not saved.

My Current Code is -

   function alumni_form_alter(&$form, &$form_state, $form_id) {
       global $user;

    switch ($form_id){
        case 'event_node_form':
            $main_organizing_members_options = array();
            $batch = 0;

            if(isset($form_state['values'])) { // Get values only after form submit
                $batch = $form_state['values']['field_year_of_passing_x']['und'][0]['value'];

            }

        $form['field_year_of_passing_x']['und']['#ajax'] = array(
            'event' => 'change',
            'wrapper' => drupal_html_id('organizing-mem-wrapper'),
            'callback' => 'organizing_members_ajax_callback',
            'method' => 'replace',
            'limit_validation_errors'=>array()
        );

        $main_organizing_members_options = alumni_organising_members($batch);

        $selected = isset($form_state['values']['field_main_organizing_members']['und']) ? $form_state['values']['field_main_organizing_members']['und'] : '0' ;
        $form['field_main_organizing_members']['und'] =array(
            '#type' => 'select',
            '#multiple' => TRUE,
            '#prefix' => '
',
            '#suffix' => '
',
            '#options' => $main_organizing_members_options,
            '#default_value' =>  $selected
            );

        break;
        default:
            break;
    }
    return $form;

}

function organizing_members_ajax_callback($form, $form_state) {
    $batch = $form['field_year_of_passing_x']['und']['#value'];

    $form['field_main_organizing_members']['und']['#options'] = alumni_organising_members($batch);

    return $form['field_main_organizing_members'];
}

function alumni_organising_members($batch) {
     $organizing_members = array();

    $SQL = "SQL query to fetch all the Ex-Students if batch is not select ";
    if($batch > 0)
        $SQL .= "WHERE BATCH =".$batch;

    $organizing_members = db_query($SQL)->fetchAllKeyed();
    return $organizing_members;
}
?>

All the help is appreciated. Am stuck with this for quite sometime now. Thanks.


texts:
What is the alternative to drupal_get_form('user_login'). in Drupal 8?

I am using the following code in theme_name.theme, but it doesn't work.

// Include namespace for userLoginForm.
use \Drupal\Core\core\modules\user\src\Form;

function MYTHEMENAME_preprocess_page(&$variables) {
  $form = UserLoginForm::create();
}


texts: How to set multi-value hidden field from javascript?

texts:
I have a multi-value text field, the values should be set from javascript on the browser.
For a single value text field, I can just set the value of the hidden field. But for multi-value text field, drupal will only take the first value and omit following values even the browser post more than one value.
I insert some input tag with same name (nearly, see below) under the form using jquery:
<input type="hidden" name="field_subscription_id[und][0][value]" value="52e1c1d99c29ec6fd84698b6" />
<input type="hidden" name="field_subscription_id[und][1][value]" value="52e1c1d99c29ec6fd84698b6" />
...

data is POST like this (inspect using dev tool of chrome):
field_subscription_id[und][0][value]=52e1c1d99c29ec6fd84698b6
field_subscription_id[und][1][value]=52e3de349c29ec6fd84698d4
...

After node created, the field field_subscription_id will only have the first value.
So, any idea to make this work? ~thx
EDIT
I define the form from UI, just a normal content type and a text field. I make a ajax request to external site from page, let user select something (from the ajax response), then fill a field of add-node form with the selected ids.
Using the AJAX response, I build a list of <li>, each <li> has a checkbox, the form attribute (HTML5) of the checkbox has been set to the value of form-id of drupal add-node form on this page.


texts: How to add a new CSS class to a Link Badge if the value is 0?

texts:
I'm using the small module Link Badges to display a badge with the amount of flagged nodes next to a link to the View in question. It works great and I've styled the badge to my needs. This is the current HTML code:

  My View

    0

Now, I'd like to display the badge a little bit differently (other colors etc.) when the value is 0. I thought about doing this by adding a new CSS class link-badge-zero to the value.

  My View

    0

How can I achieve this?


texts: XML Feeds extensible parsers: what is Value in Parser or Bundle in Processor?

texts:
I am trying to generate an apartment listing through Feeds and Extensible Parsers from a feed like this:

<?xml version="1.0" encoding="UTF-8" ?><apartmentFeed version="1.0" timestamp="20150318:16:31:51">
<apartment id="529">
<general>
    <lang>en</lang>
    <reference>000525</reference>
    <name><![CDATA[Pilatos]]>
    </name>
    <general_url><![CDATA[https://www.waytostay.com/seville-apartments/pilatos-0525/?orgid=949&utm_content=feed]]></general_url>
    <reviews_link><![CDATA[https://www.waytostay.com/seville-apartments/pilatos-0525/reviews?orgid=949&utm_content=feed]]></reviews_link>
    <location_link><![CDATA[https://www.waytostay.com/seville-apartments/pilatos-0525/location?orgid=949&utm_content=feed]]></location_link>
    <availability_link><![CDATA[https://www.waytostay.com/seville-apartments/pilatos-0525/availability?orgid=949&utm_content=feed]]></availability_link>
    <updated>2015-02-25 13:56:27</updated>
    <business_suitable>false</business_suitable>
    <number_of_apartments>1</number_of_apartments>
    <cancelation_policy></cancelation_policy>
    <class>Comfort</class>
    <themes>
                </themes>
    <inside_description><![CDATA[modern marble]]></inside_description>
    <outside_description><![CDATA[mudéjar marble]]></outside_description>
    <long_description></long_description>
</general>
<location>
    <country><![CDATA[Spain]]></country>
    <city><![CDATA[Seville]]></city>
    <neighbourhood><![CDATA[Santa Cruz – Catedral]]></neighbourhood>
    <area><![CDATA[Santa Cruz – Catedral]]></area>
    <longitude>-5.988208651542664</longitude>
    <latitude>37.38950140217916</latitude>
</location>

After navigating information and videos the whole day, the only thing I think I have clear is that the context should be //apartment (most examples are very simple XML and default Feed importer/page).

I found no information on what to do with "Value" in the settings for XML parser. I tried with empty values or just copying the "Name" or using the the names of the fields in the created destination page called "WtSFeed".
No specific info on "Bundle" either, but I guess it should go to that same destination page.

When I go to that WtSFeed page and introduce the XML address, it creates the node of the import page, but no additional nodes for the apartment pages, although the blue bar indicates it has been downloading.

To keep it simple I limited the import to just the 3 easiest data using -latitude- and -longitude- for newly created "lat" and "lon" text-fields and -reference- for the title field, since I wouldn't even know how to address the -name- that has a -![CDATA ...- in it, nor how to address "id" that is part of -apartment id="xxx"-

Probably too many doubts at the time, but if someone could explain how to at least create the new nodes from those three simple data, I'd have a starting point. Maybe it means a better understanding of "Value" and "Bundles" too.

Thanks

This is under drupal 7.34 with Feeds 7.0-2.0-alpha8 and Extensible parser 7.x-1.0-beta1
(I substituted > and < for - otherwise it disappears)


texts:
I am using LoginToBoggan Module to unable anonymous user to register using self created password.

Now in some other page I want a popup login form. I have tried using other module like modal forms, but these seems not to work.

Please show me the right way to do this.

Thank you


texts: Version numbers of dependencies in testing

texts: If I'm submitting a test to the qa.drupal.org testbot, and my module requires a dev version of another module in order to function properly, is it adequate to declare the version in my module's .info file, or do I need to also specify version numbers in the test DrupalWebTestCase::setUp() where dependencies are declared for the test itself?


texts: field_attach_form removes image field default value when submit

texts:
I need to get some fields of a node edit form, for that purpose I use field_attach_form() to get the fields that I want with the value of the node.

Here's an example of the code of my form function:

function my_form($form, &$form_state, $node_id, $fields) {
  $node = node_load($node_id);
  $node_form = $form;
  field_attach_form('node', $node, $node_form, $form_state);

  foreach ($fields as $field) {
    if ($field->show) {
      $form[$field->name] = array('#type' => 'fieldset', '#title' => t('Field'), '#tree' => TRUE,);
      $form[$field->name]['override'] = array('#type' => 'checkbox', '#title' => t('Override'),);
      $form[$field->name][$field->name] = $node_form[$field->name];
      $form[$field->name][$field->name]['#states'] = array(
        'enabled' => array(
          ':input[name="' . $field->name . '[override]"]' => array('checked' => TRUE)
        ),
      );
    }
  }

  return $form;
}

I just wrap every field (that I want to show) in a fieldset with a checkbox.

One of the field is an image type, when field_attach_form loads the field, it shows the image thumbnail and the image file name perfectly, but when I click submit (without edit the field content) the value of the field is empty. In fact, the image field is required so the validation fails.

When I remove the previous image and upload a new one, it works perfectly. Am I missing something?


texts: Need to redirect the non-existence URL's to 404 page instead of parent url

texts:
This is in connection to drupal.org issue #432384.

That's when I happen to request for page "node/1/aaa/bbbb", I'm served the response for "node/1" (it's parent page).

I can understand, this is the way Drupal menu system has been designed and works for some obvious reasons.

But I'm in a need to change this. Reason we have some aliased urls across the site, links from third party sites are taking (visitors and crawlers) to not existing page for which ideally http 404 response code and page not found to be returned. Instead Drupal showing it's parent page (with http res. code 200). This is leading to duplicate page in Google webmasters and misleading our genuine users.

I have found a patch to this issue. However it is working fine only for 80% of cases, some valid urls (admin/*, sites/default/files/ * , system/ajax/*, etc.,) leads to 404 page.

Would like to hear how others are dealing with this duplicate content issue concerning SEO and possible fix!


texts: Theming user_profile_form (the user edit form)

texts:
I am looking for easy ways to theme the user profile form that will allow me to setup a two-column layout for the form and exclude certain elements.

How can I achieve it?


texts: How to change the default images path and direct it to the external directory

texts:
I just want to know if there is anyway set drupal to upload images to the directory outside the drupal installation like loc*lhost/site-name/image-upload/... rather than
loc*lhost/site-name/drupal/sites/all/default/.... My drupal installation directory is loc*lhost/site-name/drupal/

Thank you
JOnas


texts: In the Add Article page (while editing), how do I add a custom message right above or below the Save/Preview buttons?


texts:
Drupal 8 uses Opcache, while most people still use APC for Drupal 7. I am not sure which of the two to use for a Drupal 7 site, because it appears there is no Opcache module for Drupal 7. There is this: https://www.drupal.org/project/opcache, but I don't think that will do the trick as it is a dev module.

Which of the two options should be used for Drupal 7? And if you choose Opcache, please suggest the best way to implement it, seeing as the module is in dev mode? Assuming I am using PHP 5.5 (i.e. a version that supports OpCache, which means it would be my preference as well).


texts:
I have installed a library using composer.json https://github.com/nuovo/spreadsheet-reader

Now in vendor I'm getting a folder structure like:

Now I want to use excel_reader2.php class inside my controller.

and I'm using it like:

use nuovo\spreadsheet-reader\php-excel-reader\excel_reader2;
use nuovo\spreadsheet-reader\SpreadsheetReader;

but it is giving me fatal error

  Parse error: syntax error, unexpected '-', expecting ',' or ';'

Is there any way to use folders containing '-' (dash) in their names?


texts: How to turn on block or panel from old site to the new one

texts:
I'm fairly new to Drupal. I have an old version of site with a "block" or "panel" or whatever it's called, that displays on a page, and the new version doesn't have it, and I for god's love can't figure out how to turn it on. It would require looking at it directly, because it's just something I can't see in that beautiful user friendly admin dashboard of Drupal.

EDIT: Upon closer examination, it looks like a view with "content" data that is on the old site, but the "content" is missing on new one. Anyone knowing how to deal with that, I would appriciate that a lot.


texts: How to add custom field to content view?

texts:
I would like to add to my main content view in drupal 7 (the one with the path /admin/content) a custom field called "mobile friendly".
This field should tell the user if the current node is mobile friendly. The values should be "yes" or "no".

The values theme selves are in special dedicated table which has 2 columns: the first is "nid" and the second is "mobile_friendly" (which is either "1" or "0")

I would like this field to be sortable and and i would like to filter by it also.

i have looked in the Drupal docs but didn't understood how to do it.

Can someone give me please an example in code or refer me to some close example?

Thanks in Advance


texts: How do I restrict a user to visit a particular page only certain no of times?

texts: How do I restrict a user (role) to visit a particular page only certain number of of times? I am using Drupal 6. It is for premium content. I just want to give 5 premium content views for free.


texts: Rotating Banner Module Shrinks Banner Image When It Should Not

texts:
I am using drupal 7.23,
and the module Rotating Banner https://drupal.org/project/rotating_banner
I have the banner size set to " The banner will shrink to fit the page. "
Unfortunately it is shrinking the banner when there is no change in page size.

All I have to do is load the page. The banner is initially fully expanded to the max size of the screen, but as it rotates, it will change to have a very small width.
This appears to be random, in that it just happens with enough image rotations.

Here is the css for the regular image before it becomes travel size

Here is the css for the image after it smalls down

It appears that the internal code for the module thinks the screen size shrunk down big time, but I don't know why....
I would appreciate anyones advice on this matter....

Thanks so much,

david


texts: Managed file: What is the proper way of setting #default_value?

texts:
$form['picture']['file'] = array(
  '#type' => 'managed_file',
  '#title' => t('picture'),
  '#description' => t('Allowed extensions: gif png jpg jpeg'),
  '#default_value' => (isset($foo->picture->fid) ? $foo->picture->fid : ''),
  '#upload_location' => variable_get('picture_upload_location'),
  '#upload_validators' => array(
    'file_validate_extensions' => array('gif png jpg jpeg'),
    // Pass the maximum file size in bytes
    'file_validate_size' => array(MAX_FILE_SIZE*1024*1024),
  ),
);

I have the above code snippet from here.  It's very useful, however I'm having a hard time setting #default_value.

What is $foo?  Where is it set and how can I change it?  Will I use the image uploaded on the other pages (coded in the same module).


texts:
I am using Drupal 7. I have just built a wonderful custom module. Now I need to add it to my main menu, under the parent item "Tools and Resources."

I know I can go to the homepage and click on the little gear and go to "List links", which will take me to admin/structure/menu/manage/main-menu/list?destination=node and I can click-and-hold on the little compass and drag-and-drop my module in the desired place. But, is there a way to do this through the PHP code in the module itself?


texts: Batch API error: ResponseText: {"errors":[{"message":"Not acceptable format: json"}]}

texts:
When running a batch process on Drupal 8, the following error is returned:

ResponseText: {"errors":[{"message":"Not acceptable format: json"}]}

The HTTP response is HTTP POST / 406

I can see the route is defined ok for the batch callback with the JSON support there:

select * from router where name like '%system.batch_page%' \G;
*************************** 1. row ***************************
           name: system.batch_page.html
           path: /batch
pattern_outline: /batch
            fit: 1
          route: C:31:"Symfony\Component\Routing\Route":970:{a:9:{s:4:"path";s:6:"/batch";s:4:"host";s:0:"";s:8:"defaults";a:2:{s:11:"_controller";s:52:"\Drupal\system\Controller\BatchController::batchPage";s:15:"_title_callback";s:57:"\Drupal\system\Controller\BatchController::batchPageTitle";}s:12:"requirements";a:2:{s:7:"_access";s:4:"TRUE";s:7:"_format";s:4:"html";}s:7:"options";a:4:{s:14:"compiler_class";s:34:"\Drupal\Core\Routing\RouteCompiler";s:12:"_admin_route";b:1;s:12:"_no_big_pipe";b:1;s:14:"_access_checks";a:1:{i:0;s:20:"access_check.default";}}s:7:"schemes";a:0:{}s:7:"methods";a:2:{i:0;s:3:"GET";i:1;s:4:"POST";}s:9:"condition";s:0:"";s:8:"compiled";C:33:"Drupal\Core\Routing\CompiledRoute":312:{a:11:{s:4:"vars";a:0:{}s:11:"path_prefix";s:0:"";s:10:"path_regex";s:12:"#^/batch$#sD";s:11:"path_tokens";a:1:{i:0;a:2:{i:0;s:4:"text";i:1;s:6:"/batch";}}s:9:"path_vars";a:0:{}s:10:"host_regex";N;s:11:"host_tokens";a:0:{}s:9:"host_vars";a:0:{}s:3:"fit";i:1;s:14:"patternOutline";s:6:"/batch";s:8:"numParts";i:1;}}}}
   number_parts: 1
*************************** 2. row ***************************
           name: system.batch_page.json
           path: /batch
pattern_outline: /batch
            fit: 1
          route: C:31:"Symfony\Component\Routing\Route":858:{a:9:{s:4:"path";s:6:"/batch";s:4:"host";s:0:"";s:8:"defaults";a:1:{s:11:"_controller";s:52:"\Drupal\system\Controller\BatchController::batchPage";}s:12:"requirements";a:2:{s:7:"_access";s:4:"TRUE";s:7:"_format";s:4:"json";}s:7:"options";a:3:{s:14:"compiler_class";s:34:"\Drupal\Core\Routing\RouteCompiler";s:12:"_admin_route";b:1;s:14:"_access_checks";a:1:{i:0;s:20:"access_check.default";}}s:7:"schemes";a:0:{}s:7:"methods";a:2:{i:0;s:3:"GET";i:1;s:4:"POST";}s:9:"condition";s:0:"";s:8:"compiled";C:33:"Drupal\Core\Routing\CompiledRoute":312:{a:11:{s:4:"vars";a:0:{}s:11:"path_prefix";s:0:"";s:10:"path_regex";s:12:"#^/batch$#sD";s:11:"path_tokens";a:1:{i:0;a:2:{i:0;s:4:"text";i:1;s:6:"/batch";}}s:9:"path_vars";a:0:{}s:10:"host_regex";N;s:11:"host_tokens";a:0:{}s:9:"host_vars";a:0:{}s:3:"fit";i:1;s:14:"patternOutline";s:6:"/batch";s:8:"numParts";i:1;}}}}
   number_parts: 1
2 rows in set (0.00 sec)

Just wondering if anyone else has encountered this error for the Batch API processing and may have some suggestions on it.


texts: Average value of Multiaxis FiveStar value

texts:
configuration Drupal 7.7, FiveStar 2.x-dev, References module, Unique field.

I have node value of Story tale
Every user can write an Review and rate each story tale with multiaxis fivestar like: Idea, Grammar, etc. configures as rating references.
Every user can create only one review per each story tale (unique field module).
Rating is available when User create a Review node (so not ajax).

I can attach average rate of each one from multiaxis like Average Grammar, Average Idea etc for story tale by views.

What I can't do is: how to compute average of all multiaxis values it menas create one number computed from rating of Grammar + Ideas.

I tried create a Fivestar field for overall (average value).
Then I created Computed field which compute overall value of review.

$overall = ($entity->field_style[$entity->language][0]['rating'] + $entity->field_rate[$entity->language][0]['rating'])/2;
$entity_field[0]['value'] = $overall/10;
$entity->field_overall[$entity->language][0]['rating'] = $overall;

Well Problem is that In field_overall is stored requested value, but VotingApi don't register this change created by computed field and it count 0 as stored value.

So.
1. Problem is that fivestar store this value before computed field compute overall rating
2. Or problem is, that fivestar is reading value not from $entity->field_overall but from other value.


texts: How to add some JavaScript functions before Ajax begins

texts:
How do I add some JavaScript functions before Ajax begins, with FAPI?

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => 'Upload',
  '#ajax' => array(
    'callback' => 'ajax_submit_key_dump'
  ),
);


texts: Issues sending HTML email with Simplenews module

texts:
I am able to send plaintext emails with the Simplenews module.
I have installed the Mimemail module; I configured the mail system to use Mime Mail Mailer in DEFAULT MAIL SYSTEM. After sending the emails to queue, when I run the CRON job, Drupal displays an error message:

  Unable to send email. Contact the site administrator if the problem persists.

Has anyone used Simplenews to send HTML emails in Drupal 8.1.1? If so, can you please advise how to do this?


texts:
These seem to return the same thing:

\Drupal::request()

$request_stack->getCurrentRequest()

Which is the preferred way to get the current request and why? Is one of these to be deprecated? Any other advantages/disadvantages?

Thanks!


texts: Images are uploaded but those are not avaliable in a form

texts:
I have a problem with webform module and that too with my site only :(
When I add form field with image upload, photos are uploaded but when I check submissions there are empty places, only I can find this photo in FTP in path sites/all/webform/

When I add required field, so user can not go to the next page break
I choose file, format and weight is correct, I click upload a file, looks that is uploaded

I try to go to the next page break but it is impossible because appears a notice that this field is required and is empty...

I try to do in another webform created, without page breaks and another fields, but issue is the same.

In another drupal site in my server I don't have this issue. If you want to reproduce please go to my site:
vidicon.nazwa.pl/brodnica/zgloszenie_firmy

please fill fields with* and after upload photo in last field and try to go to next step. It will be not possible but I will have this image on my server in /sites/default/files/webform/...

BTW I try to create a another simple form with image upload field and the same issue occurs, permission I set the same as in other site where webform works properly. I don't have any ideas, but I need this webform to my site :(

Thank you in advance for help.


texts: Calendar module: Where is the pager markup? How can I translate it?

texts:
This is so driving me insane. I installed this: http://drupal.org/project/calendar

Now I'm trying to get the 'Next' and 'Prev' links in the monthly calendar to translate. Those strings don't show up in string translation, so I decided to look for their origins; where do they come from. Problem is, I can't even find the markup. The rendered final markup looks like

        « Prev      &nbsp;

&nbsp;
        Next »

It has to be somewhere, but where?


texts: How does drupalxray.com find out the modules present on a thirdparty website?

texts:
drupalxray.com gives an exhaustive list of the modules present in a third party website. How does it ascertain which are the modules present on a site?

Note : It also identifies the modules which are not enabled.

Based on How to determine the modules enabled on a third party website? but making it a separate question as others might find it useful.


texts: The link generated by a View's header (Global: Text area) is only visible for the admin role and I need it to show for other roles

texts:
I have the following code in the View's header (Global: Text area).

<?php
  global $user;
  if (user_access('create page content', $user)) {
    $output = l(t('Publica un artículo nuevo'), 'node/add/articulo');
    print $output;
  }
?>

If I log in as admin I can add an "articulo" by clicking on the link that the PHP generates in the header of the view. However if I log in as a different role I can still add an "articulo" by using the navigation menu but for some reason the link generated by the code above disappears i.e. the link is only visible for the admin role and I want it to be visible for other roles as well. I have tried changing the permissions for the different roles but it has not worked. If the other roles can create content from the navigation menu why does this link disappear for them. Do I need to change something within the view or ...?

Thanks in advance.


texts: Store only a resized version of an enormous uploaded image

texts: I have editors uploading images the size of 3.8MB. I don't want to lower the maximum size for image/file upload (it's set to be 5MB), that's because I use core Image Styles (admin/config/media/image-styles), but for a server's sake, is it possible to make them upload that enormous file but just store a resized, smaller version of it? let's say, store a reduced 800x800px version of it?


texts: Notification + Subscription: Can this combination recipe be used to create notification system similar to Facebook's?

texts:
I understand that this combination of Notification + Subscription modules can accomplish a lot of different notification setups. However, I am only looking to emulate the notification system similar to Facebook, as in this example:

Can anyone provide any tip or guidance as to how this combination may be configured to achieve this goal?

Any sugestions?


texts:
Im pretty new with advanced views and references module (Drupal 7). Im seeking for some help.

I would like to sort nodes based on node post date of the nodes that references it. So I have node type A and node type B that can reference node type A (A-one, B-many). I would like to sort type A nodes based on which has the latest Type B node.

Almost like journals that can have posts and I would like to see a list of the journals that have the newest posts.

Any idea how to approach this correctly, I seem to struggle and get some odd results.

Update:
I would like to sort the journals by the newest post in them. Right now it sorts by the first post in journal. Any idea how to set this? (obviously setting the sort criteria on the sort field to ascending doesnt work, because it will just flip the list of journals...)


texts: Error when loading views programatically

texts:
In my views i added a link to go to some page that has a php code in it's body.
The code loading the same views.
The code:

<?php
$view = views_get_view('charge_numbers');
$view->set_exposed_input();
$display_id = 'default';
$view->set_display($display_id);
$view->render();
print_r($view->preview());
?>

The views load correctly but this error message appear:

I did this step in another website and it's work perfectly.
Some advices please.


texts:
Is it possible to make a field either editable or appear after a date?

I have a content type with a Title, Date and 'Winning Numbers' field. The winning numbers field should only be fillable/editable AFTER the Date in the date field has passed.


texts: do thumbnail image styles lower the page load

texts:
This may not be a Drupal specific question, but when I use image styles to resize from a full to thumbnail size, will the page load still behave as if its a hiqh quality image, or does it lower the page load?

I'm trying to figure out if there should ever be a reason to provide two upload fields on a content type, one for a high quality image and one for a lower one.


texts: How to install the module Entity Browser?

texts:
I'm trying to install the Entity Browser module, but I'm getting this error:

It basically says that the "entity_browser" entity type does not exist, and based on the error I tried to install the missing entity type, using drush:

Once I ran drusn entup I was asked to install the missing entity, but drush ended returning the same error I'm getting in the browser.

Could I be missing something?


texts:
I am new to Drupal 7 and I just installed views. I have a view all set up with a text field and an image.

This view would be used as a Welcome paragraph to my site. It will also have a picture of a map off to the right side of the paragraph.

I have it all working but the image just shows up under the text I am currently using the unformatted list option. If I use the inline option then it looks weird because the image makes a huge white space between the first and second line of the text.

I don't want to use the table option because I don't like the whole look of a table.

I noticed the Style Settings when I was editing the Image Field. and I saw you could wrap the image in a <div> and give that <div> a style class. So I added a class called MyStyle. But I have no clue as to where I am suppose to put the CSS to create that class.

I saw a post that said I would need to add it to my theme. So I went into the bartik.info and added a new css file to it. And in that CSS file I added and defined my class. But it doesnt seem to affect anything.

How do I make this work?


texts: Subpages in Panels like Drupal Blocks using section/*

texts: I want to manage a page with subpages in panels. I thought the url path setting like section/* will also work in panels like with normal Drupal Blocks. For example i want to ad a menu pane with links to some views like section/myview . The user go to this link and the panel page is gone because it dont check that is a subpage. How can i manage this?


texts: Metatags only appears on node pages, but don't appear on pages

texts:
I think this is a simple question. When I build a new node and add some meta-tags on this node, this meta-tags appears normally when I access the node directly (http://www.example.com/node/<id>, for example).

But, when a add this node on a page, and access the url of the page, the meta-tags do not appears on page.

I am using Drupal 7.24 and metatags (quick) module.

Thanks

Update: It's not the same question as asked in Meta Tags on Frontpage and found a solution for my problem.

I needed to change a configuration in a specific page. So, I went to: Content > Page > Selected the Content > Edit > Variants > Panel > Content. Clicked on gear (right side) > Configuration > Selected Show Full Content.


texts: Get the select list current value not key

texts:
For example, There is a field with 3 options in allowed values, like option1, option2, option3.Is there any function which receive the field name and returns selected values not a keys ?

With this just return key of selected opinion

  print ($node->field_opinion['und'][0]['value'])

Update :

I have create select list field and with this field user can answer and select own value like this

1|Stars
2|Nights
3|Awesome
4|Days

With above code just return the keys field and i want to return values like "Stars"


texts: How can a module check if Drupal is showing one of the update pages?

texts:
What should a module do to verify if Drupal is updating the database tables to avoid to output a message when one of the update pages are being shown (or to avoid to do any superfluous task during the update)?

The module I am referring to is a custom debugging module that does some tests at every requested page, and outputs the result using drupal_set_message().


texts:
When we add a facet block to the page, a filter is selected and the page starts to load the results. However there is no loading icon or indicator the change is being applied.

When we check the page, there is no JS error and nothing visible.

How do we get the loading icon or throbber to show when a facet is selected?


texts: Is there a way to show different no results behaviors for different languages in views 3.


texts: Issue using Config Split on content types

texts:
I'm working on setting up Config Split to share content type config between a number of multisites. Currently each site has its own config for various content types but, since they should be identical across all sites, I'd like to use Config Split to make it easier to manage.
I've configured Config Split with just just split off all config related to a content type with: node.type.mycontenttype. This works fine an all config is split out.
When I try to import it into one of the other sites it first tries to delete all existing config before importing the split. This causes it to fail since entities of that type already exist.
Is there a way around this or am I approaching this incorrectly?


texts:
I'm currently building my first Drupal theme (have experience in other content manager systems) and just have a quick question regarding normal practice...

So, I have a number of different templates for a website theme I am building

Home > Level 1 > Level 2 > Article

I have created Content Types for each of the different templates e.g

*node--level_1.tpl.php*, *node--level_2.tpl.php*

By default it seems that the page's title is printed in page.tpl.php.

My plan is to delete the title from page.tpl.php and render it where appropriate within the node templates.

My question is simply is this ok? Is this normal practice? And are there any implications/consequences of doing this?

It's worth saying the reason for doing this is that on some levels there is no title, and often when the title exists it has to rendered under an image (so printed under the custom image field).

Obviously one issue I instantly thought of is that for default pages such as /user the title won't be printed. Could I use some logic in page.tpl.php to say print the page title only if it is not printed within the content type node template?

Thanks for your time!

Scott


texts: How do you add a custom field to a menu link in Drupal 7?

texts:
I am currently using the menu module (Drupal 7 Core) to manage my menus. A menu link consists on only a title and a description. I would like to add an image field as well as another text field. I have considered using taxonomy rather than menu links, but I still want the capability to add a basic page to a menu.

I have looked into a module called Menu Attributes http://drupal.org/project/menu_attributes, but it doesn't add an image field.


texts: CKEditor: Change tag filtering from a list of 'allow' to list of 'dis-allow'

texts:
I have two CKedit text filter profiles --

Advanced
Full HTML.

The Advanced allows a restricted set of HTML tags and the Full filters no tags.  I want to add a second profile that is allowed the Full set of tags with the sole exception of <script>.  I have found much documentation on allowing <script> but find nothing about restricting just this one.

It seems counter intuitive that the only way would be to build a list of all html tag leaving out only this one.


texts:
I've implemented the IMCE module and added it to the CKEditor. When we upload files though, the resized images come out fine, but the uploaded file itself is saved in the same directory with incorrect file permissions, which causes the file to not be viewable in the browser.

Upon inspection, the uploaded file has no effective permissions for the IUSR account, but the resized images have the needed permissions for IUSR.

Does anyone know how I can resolve this issue?

We are running IIS7 with Drupal 6.


texts:
The Drupal site is connected with two databases like this:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'default',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
    'remote' =>
    array (
      'database' => 'remote',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

The remote database is in remote site, however in the new site I have identical content type for eg: Newsfeed.

The Newsfeed content type in new site has one more field entityreference and in this entityreference I would want to refer to the Node ID of the remote existent content of the same content type.

eg: In remote site, the content is "Hello my friend" of content type newsfeed and the nodeId is 12.

In new site, in same content type if I write a content "Hello all my friend" and in the entityreference field I want to give the nodeId of Hello my friend content from remote site.

All this I want to do it automatically with entityreference Autocomplete field. I know the entityreference Autocomplete can show the contents from same database while doing the autocomplete (given correct settings is done while creating the field). However is it possible to switch the database while entityreference autocomplete is working? If so, how?

The database switch is just to get the nodeId of the content from remote and it'll be switched back after the autocomplete.


texts:
I can't login My drupal website (D 7.23) now.
I have changed the password and tried to login back, but still the problem exists. After I reset the password by using the one time password and can log in, but when we log out and try again to login, it will be a failed one.

Please help me to solve it.


texts: Drupal 7 login form redirect back to page which they logged in on

texts:
$node->content['my_form'] = drupal_get_form('user_login');

I am creating a form that as outputted on http://site.com/datacollection/the-data-collection

When the user successfully logs in they are redirected to users/USERNAME

In drupal 6, the user would be redirected to the same page they logged in from...How can I reproduce this behavior?


texts: Parent menu display submenu rather reload the page

texts:
Hi I installed a bootstrap theme in drupal 7. I had a requirement to bring hover support to drop-down menu and make parent menu clickable to display its own content. I acheive this through some css and theme_menu_link. But Now the problem is with mobile version when I click main-menu item the page is reloaded and cannot access the dropdown submenu. So it it possible to make parent menu display submenu in touchscreen devices without reloading the page with my piece of code or any other solution? Plz help

Thanks in advance!

function mytheme_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';

if ($element['#below']) {
// Prevent dropdown functions from being added to management menu so it
// does not affect the navbar module.
if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
  $sub_menu = drupal_render($element['#below']);
}
elseif ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] == 1)) {
  // Add our own wrapper.
  unset($element['#below']['#theme_wrappers']);
  $sub_menu = '
' . drupal_render($element['#below']) . '
';
  // Generate as standard dropdown.
  $element['#title'] .= ' ';
  $element['#attributes']['class'][] = 'dropdown';
  $element['#localized_options']['html'] = TRUE;

  // Set dropdown trigger element to # to prevent inadvertant page loading
  // when a submenu link is clicked.
  $element['#localized_options']['attributes']['data-target'] = '#';
  $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle disabled';

 }
}
// On primary navigation menu, class 'active' is not set on active menu item.
// @see https://drupal.org/node/1896674
if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']))) {
  $element['#attributes']['class'][] = 'active';
}
  $output = l($element['#title'], $element['#href'],    $element['#localized_options']);
  return '
' . $output . $sub_menu . "
\n";
}


texts: Use multiple URL arguments to prepopulate multiple entity reference fields

texts:
I have multiple nodes of type 'schools'

I also have a contact form that i'd like to provide on a per school basis.

I.e. The user views a school page and can use an entityform embedded or linked to that particular schools page to generate a pdf letter to mail to the school. This letter will be pre-populated with the School name, School address, Head Mistress and other fields from the 'schools' content type that it came from.

I have set up 'entity reference' and 'entityreference prepopulate' as per this tutorial and have made some  headway.

However I can so far only successfully pass one item from the node to my form using url arguments ... how can I pass multiple arguments ~5-6 elegantly to prepopulate my entity form?

I am open to alternative approaches, it would be nice to have the form embedded on the schools page...rather than linked (via the block in the above example)


texts: How to define ranges for integer/decimal/float fields in D7?

texts:
I would like to add an integer/decimal/float field to a content type where users can define ranges for these numbers as two separate fields.
Like when adding a Date field, and being able to add an end date as a separate field with a little checkbox:

 (So the output will be like this: 2011 - 2012.)

Use case: users would like to define approximate numbers, they don't know data exactly, for example:

Stream bed's average depth: 0.3 m - 1 m
Stream bed's average width: 1 m - 2 m

(m would only be a suffix)
etc.


texts: Can't Write to Public Files but Permissions Appear Fine

texts:
Need the internet to confirm my sanity. On a Drupal 7 site it's saying "The directory sites/default/files is not writable." So I checked every permission but I don't see the issue. Since this isn't a public server, I temporarily turned off SELinux. Another Drupal 8 site is running on the same server with the exact same permissions. What am I missing?

getenforce output:

Permissive

ps aux | grep httpd output:

root     29064  0.0  0.1 262224  6492 ?        Ss   18:26   0:00 /usr/sbin/httpd -DFOREGROUND
apache   29065  0.0  0.0 261884  3672 ?        S    18:26   0:00 /usr/sbin/httpd -DFOREGROUND
apache   29066  0.0  0.2 1188648 10040 ?       Sl   18:26   0:00 /usr/sbin/httpd -DFOREGROUND
apache   29067  0.0  0.2 1778408 8000 ?        Sl   18:26   0:00 /usr/sbin/httpd -DFOREGROUND

/sites/default/files is a symlink and the permission should be ignored

lrwxrwxrwx 1 root   root    31 Mar 18 18:14 files -> /mnt/efs/website/publicfiles/

So let's go down the tree

drwxr-xr-x 12 root root 6144 Feb 17 23:27 efs

drwxr-xr-x 4 root root 6144 Feb 17 23:28 website

drwxrwxr-x 110 apache web 141312 Mar 18 18:16 publicfiles

EDIT (from comment below):
/etc/httpd/conf/httpd.conf:

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
</Directory>

<VirtualHost *:80>
... server info ...
<Directory "/var/www/html/website/public_html">
AllowOverride All
Require all granted
Options -Indexes +FollowSymLinks
</Directory>
</VirtualHost>

.htaccess:

# Follow symbolic links in this directory.
Options +FollowSymLinks


texts:
The Drupal Twig clean_id filter calls HTML::getId(), which is inferior because accessibility tests fail if your ID appears twice, for example when the template is placed twice on a page. In the vast majority of cases, if you're generating an ID in Twig you really need to be guaranteeing uniqueness.
Hard to believe Drupal doesn't support this out of the box.


texts: Drupal 7 & Facebook Connect - Connect Button Problem! Help please?

texts:
I installed the module Drupal For Facebook. So far it was working perfectly, I enabled Facebook Connect and put the Facebook Connect login block in a sidebar. It was great until I went into configure the Facebook Connect login block and changed text in the body. Now the CONNECT button no longer appears and only text appears saying the words "Connect." I've tried every mix of plain text, full html, and filtered html to include the suggested enter of: Connect to no avail. The only thing I see is the word Connect in plain text every time.

I need to reset this module to default or learn how to properly add the button back. But I am very new to Drupal and have no idea how to do it.


texts: Adding content to a page through a module

texts:
I just want to echo some words when a certain node comes up.

Currently however it doesn't echo within the content section, but above the header.

How do I get my module to echo the words at the top of the content section?


texts:
On a multilingual site, the function named language_negotiation_get_switch_links($type, $path) looks up the content translation and enables user to switch to parallel content if available.
What if the path comes from Views with contextual filter being the node ID? Say, in English it'd be en/news/197 but in German de/nachrichten/198. Drupal/Views tend to leave the contextual filter untouched and produces invalid criss-cross paths such as de/news/197. There seems to be no way to translated the value into one that belongs to a given translation set.

Is there? Or maybe I'm approaching the problem in a wrong way...


texts: How to maintain two domains in the same installation having different $base_url

texts:
I have published a new domain for my drupal installation. It has a fixed $base_url configured in settings.php. For example: https://www.olddomain.com.ar . It throws an ajax exception when I use a textfield with an autocomplete_path under the new domain https://new.domain.com.ar

The error is:
"An AJAX HTTP request terminated abnormally."

can anyone help me?


texts: Advise a Drupal Image gallery module with an option to put text nearby the image (for medical atlas). I could find a dozen of them, can`t choose before installing and setting them up. Thank you.


texts: Drupal Commerce assign role on account create on checkout

texts: When a checkout is completed by an anonymous user on a Drupal Commerce website, a Drupal account will be created. I would look to auto-assign a role like 'customer' to the newly created Commerce user. How can I do that programmatically? It has to be in Drupal 7 code so I can use it for my custom module.


texts: how can I make date fields come out in other languages in webform with drupal 7

texts:
using drupal 7 , and Webform 7.x-3.18 + 3-dev
I need my date field to come out in spanish, mes/dia/ano

but it keeps on coming out with month/day/year

How can I fix this?
thanks


texts: Compound field that includes a file field

texts:
I'm trying to figure out how to create a custom compound field, but I'm not quite sure how to add a file field to it.  There are plenty of tuts on creating compound fields that are comprised of text fields, but I can't find any that talk about combining text and file fields.  I guess the main problem is that I don't understand how the 'schema' function would work, since it refers to Drupal data types, but the data uploaded via the file field won't be stored in the Drupal database, but rather stored on disk, as any other uploaded file would be.

Can someone point me in the right direction?


texts:
I want to theme the language switcher. How would I do this in Drupal 8?

Where would I find the correct twig template?


texts: Issue while configuring site acess for Multi-Site over same drupal content using domain access module

texts:
I have a drupal site with over 100k nodes. I now need to add 2 more domains and share teh content across these domains. Using Domain access module i have created the domains and made content type default to all domains. This works great for new nodes.

However, i cant figure out how to bulk assign existing nodes to all. VBO doesnt seem to have a domain access integration. Domain content does allow bulk updation but thats only 50 nodes at a time. Doing 100k will take a massive amount of time.

Any suggestions?


texts: How do I force nodes to have revisions by default when using REST?

texts:
We have a headless Drupal 8 content repository which we access via the REST API.  I'd like Drupal to track revisions automatically for all nodes, as soon as they are created.  I'm only aware of the "create new revision" checkbox on the node edit form.

How might I set Drupal to create revisions automatically?

All nodes are created programmatically via the REST API.


texts: Form State in the field instance settings form

texts:
How do I access the global form state of the field instance settings form. hook_field_instance_settings_form only takes two arguments - instance and field.

Use case - Ajax refresh of an options list


texts: Override field module function in custom module?

texts:
I want to override field_sql_storage_field_storage_write(), defined in /modules/field/modules/field_sql_storage/field_sql_storage.module.

I tried with MYMODULE_field_storage_write_alter($entity_type, $entity, $op, $fields), but it doesn't work.

How should I override that function?


texts: How to show the number of times a page has been shared by all services total?

texts:
Is it possible to show a small block (using code or a module or something) that shows how many times the page a user is on has been shared using ANY of the available sharing methods?

For example, I'm trying to use the social sharing module AddThis and I'm showing the Facebook, Twitter, and Pinterest, and Email icons (although I also want to use the 'more' icon to show all the others).

And I want a little box to the right of those that just shows how many times the page has been shared. Is this even possible?


texts:
I have 2 roles. Each role can create a certain content type. Both content types are using the same taxonomy terms in several fields:

Content type 1: Project
- Field: Service Type (Term reference)
- Field: Cost (Term reference)

Content type 2: Preferences
- Field: Service Type (Term reference)
- Field: Cost (Term reference)

Role 1 can create unlimited projects (1:n), while role 2 can only create 1 preferences node (1:1).

Now I want to create a view for role 2 users, displaying all the projects that match their preferences. I know this is done by certain relationships in the view. I just can't figure out which ones to set.

Thoughts?


texts: Commerce checkout - Update cart pane after user select a shipping option (ajax)

texts:
I am working on a one page checkout and I'm trying to get the cart review pane updated with a shipping price while user selects a shipping option.

I have attached #ajax information to the shipping options, to update the cart review form when a shipping option is saved.

Modifying the commerce shipping ajax callback on checkout

if($form_id == 'commerce_checkout_form_checkout') {
  $form['commerce_shipping']['shipping_service']['#ajax']['callback'] = 'mshop_shipping_pane_service_details_refresh';
}

Ajax callback

function mshop_shipping_pane_service_details_refresh($form, $form_state) {
  // Update shipping form
  $commands[] = ajax_command_replace('#' . $form['commerce_shipping']['service_details']['#id'], render($form['commerce_shipping']['service_details']));

  // Update checkout cart review
  list($view_id, $display_id) = explode('|', variable_get('commerce_cart_contents_pane_view', 'commerce_cart_summary|default'));
  $commands[] = ajax_command_replace('.view-mshop-cart-shopping-cart-summary', commerce_embed_view($view_id, $display_id, array(arg(1))));

  return array('#type' => 'ajax', '#commands' => $commands);
}

The issue :
The AJAX is working, the updated cart review view is updated, but the shipping option is not applied.

My guess is that, as the form is only updated and not submitted, the order is not saved. So as the cart review's view is based on the order, and the shipping option is not saved yet in the order, it does not display the right shipping information in the cart review.

Any workaround?

EDIT:

Thanks to milkovsky comment I have been able to save the order with the shipping rate applied to the order. Then the cart review view displays correctly with the updated cart rate applied.

/**
 * Ajax callback: Returns the shipping details form elements that match the
 * currently selected shipping service.
 */
function mshop_shipping_pane_service_details_refresh($form, &$form_state, $checkout_pane, $order) {

  // Get order from form
  list($order, $checkout_pane) = $form_state['build_info']['args'];

  // Load up to date order
  $order = commerce_order_load($order->order_id);

  // Get selected
  $service_name = $form['commerce_shipping']['shipping_service']['#default_value'];

  commerce_shipping_service_rate_order($service_name, $order);

  // Delete any existing shipping line items from the order.
  commerce_shipping_delete_shipping_line_items($order, TRUE);

  // Extract the unit price from the calculated rate.
  $rate_line_item = $order->shipping_rates[$service_name];
  $rate_line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $rate_line_item);
  $unit_price = $rate_line_item_wrapper->commerce_unit_price->value();

  // Create a new shipping line item with the calculated rate from the form.
  $line_item = commerce_shipping_line_item_new($service_name, $unit_price, $order->order_id, $rate_line_item->data, $rate_line_item->type);

  // Save and add the line item to the order.
  $new_line_item = commerce_shipping_add_shipping_line_item($line_item, $order, TRUE);
  commerce_order_save($order);

  // Update shipping form
  $commands[] = ajax_command_replace('#' . $form['commerce_shipping']['service_details']['#id'], render($form['commerce_shipping']['service_details']));

  // Update checkout cart review
  list($view_id, $display_id) = explode('|', variable_get('commerce_cart_contents_pane_view', 'commerce_cart_summary|default'));
  $commands[] = ajax_command_replace('.view-mshop-cart-shopping-cart-summary', commerce_embed_view($view_id, $display_id, array($order->order_id)));

  $commands[] = ajax_command_after('.main form', theme('status_messages'));

  // $commands[] = ajax_command_after('.'.$form['#attributes']['class'][1].':eq(0)',theme('status_messages'));
  return array('#type' => 'ajax', '#commands' => $commands);
}


texts: How to get the value of a content type field in Drupal and pass it to a JS file

texts:
In my Drupal theme I have a field for soundCloud URL which its machine name is (field_soundcloud_url_) I have a javascript file that will work based of the value of this variable. But it does not work. Here is how I tried to do it:

page.tpl.php

<?php
  $node = node_load($nid);
  $sound_cloud_url = $node->field_soundcloud_url_['und'][0]['value'];
  drupal_add_js(array('my_module' => array('sound_cloud_url' => $sound_cloud_url)), 'setting');
?>

JS File

Drupal.settings.my_module.sound_cloud_url

Am I doing it correctly? Any idea?


texts: Skip a form step programmatically in simple_multistep module

texts:
I am trying to skip a step in multistep node form using Simple Multistep module. I have tried following snippet that works pretty good to skip one step.

$skipStep = $form_state->get('multistep_controller');
$skipStep->increaseStep();
$form_state->setRebuild();

However, it has a problem click on back button it doesn't come back.

I have search a lot but no luck, do anyone have idea?


texts: How to add rows to a form table with AJAX Callback in Drupal 8

texts:
I try to implement a button to add rows to a form table.
Each clic on the button should add a new line.

My problem is that my modifications in the AJAX Callback doesn't seem to modify the actual $form object :

At the first clic, row n°6 is added but without default values, wich is already a problem. The next clics have no effect, the $form parameter in the callback doesn't contain the 6th row.

What is the way to actually modify $form ?

Here is the build form :

public function buildForm(array $form, FormStateInterface $form_state, Array $profile = NULL) {

$form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
);

// table
$form['myTable'] = array(
'#type' => 'table',
'#header' => array(t('COL 1'), t('COL 2'), t('COL 3')),
'#prefix' => '
',
'#suffix' => '
',
);
// Build the table rows and columns.
for ($cpt = 0; $cpt <= 5; $cpt++) {
// Table row
$form['myTable'][$cpt] = $this->getTableLine($cpt);
}
$form['addRow'] = array(
    '#type' => 'button',
    '#value' => t('Add a row'),
    '#ajax' => array(
            'callback' =>  '::ajaxAddRow',
            'event' => 'click',
            'wrapper' => 'my-table-wrapper',
    ),
);

return $form;

}

Here the function called to fill the rows :

function getTableLine($key) {
    $line = array();

    $line['col_1'] = array(
            '#type' => 'textfield',
            '#default_value' => 'col 1 - row ' . $key,
    );
    $line['col_2'] = array(
            '#type' => 'textfield',
            '#default_value' => 'col 2 - row ' . $key,
    );
    $line['col_3'] = array(
            '#type' => 'textfield',
            '#default_value' => 'col 3 - row ' . $key,
    );
    return $line;
}

And the Ajax callback :

function ajaxAddRow($form, $form_state) {
    $cpt=0;
    for ($x = 0; $x <= 10 & $form['myTable'][$x]; $x++) {
        $cpt++;
    }

    // $cpt always return 6 - expected to increment
    // $form['myTable'][$cpt] is always empty

    $form['myTable'][$cpt] = $this->getTableLine($cpt);

    return $form['myTable'];

}


texts: How to programatically get the machine name of a node?

texts:
I want to add the machine name of every node into my page.tpl.php template as a class on the body.  How can I get that machine name?

I have access to the node object, but I don't see the machine name in there.  Is there an api call I can use?


texts: How do I set up PayPal parallel payments in Drupal 7 Commerce Express Checkout module?

texts:
After an exhaustive online search, I can't find an answer to my problem: where do I place the code snippets PayPal provides to implement PayPal parallel payments in Drupal 7's Express Checkout module? I went to this site to find the code snippets to paste into my site's code, but unfortunately, I can't figure out what file to paste the code snippets into in the Express Checkout module. I've read all of the instructions on PayPal, and being a relative beginner at Drupal (and a total beginner at PayPal), I can't figure out what to do next.

I am trying to allow users of my website to buy downloadable files provided by other users. When they do so, I want to take a small commission for posting their materials on my site. I understand that chained payments is also an option people use for this type of scenario, but considering my inexperience with PayPal, I think that parallel payments is the better of the two options.

In case it matters, I'm working in PayPal's sandbox mode. I've downloaded the paypalplatform.php file and I think I'm supposed to upload this to the main Express Checkout folder (but I'm not sure?), and I understand how to get my sandbox API credentials from PayPal, but I'm pretty much clueless from that point on.

The two specific snippets I'm having trouble with are these:

1.) The one in step 3a, where the instructions say "Insert this code snippet into the section of your code that initiates the preapproval flow on your website." What code initiates the preapproval flow?  Is it contained in a file in the Express Checkout folder somewhere? In which file is it located, and specifically, where in the code should I paste the snippet provided by PayPal?

2.) The snippet provided in step 4c, where the instructions say "Insert this code snippet into the section of your code that initiates a PARALLEL PAYMENT on your website." Again, where is this code located?  Is it in a file in the Express Checkout folder? In which file is it located, and specifically, where in the code should I paste the snippet?

Any help anyone can give me would be much appreciated. Thank you.


texts:
Is there any way to add the taxonomy term reference (tags) for each image uploaded? It just has 'alt tags' and title as default...

So far I can just add tags for a set of images (albums) but I want to be able to tag each of the images separately - one by one.


texts: Is it possible to show only node contents in shadowbox pages?

texts:
I'm looking for a method to display content (nodes) in a shadowbox overlay without any blocks or menus around it. even if the user is logged in.

Has someone an Idea how to do this are there even better parameters for rel shadowbox than the height and width parameter to reduce  the window size?


texts: Can't acces my site and without login and drush clear cache

texts:
I moved my local site to shared host.

all code has been deployed to the staging server
I changed settings.php
import the database from local to the staging server database

When I try to reach the site I get an HTTP ERROR 500. In phpMyAdmin I TRUNCATE the cache tables:

TRUNCATE cache_config;
TRUNCATE cache_container;
TRUNCATE cache_data;
TRUNCATE cache_default;
TRUNCATE cache_discovery;
TRUNCATE cache_dynamic_page_cache;
TRUNCATE cache_entity;
TRUNCATE cache_menu;
TRUNCATE cache_render;
TRUNCATE cache_toolbar;

If I look in the error logs I see:

AH01071: Got error 'PHP message: PHP Fatal error:  Class 'Drupal\\Core\\Cache\\DatabaseBackend' not found in /home/mysite.nl/public_html/staging/index.php on line 16\n'

What do I have to do?


texts:
I want to make it easy for web managers to change content in panel layouts.
I.e. not the layout in itself but specific content.

For view listings in panels, it is quite straight-forward for web managers to add content (just by navigating to the particular content type and "add/modify").

For static content however (like introductions to a particular page), I am not sure what the best alternative is?

Example:
Let us say I create a panel page "FAQ" which should look something like this:

  FAQ

  "Pane 1"
  On this page you find answers to some of the most
  frequently asked questions ...

  "Pane 2"
  Q: Bla bla
  A: Bla bla

  "Pane 3"
  Links to other parts of the webpage block

In this example, how would you set up the intro text ("On this page ...") so that editors can easily tweak it? Is it a content type, a block, custom non-reusable content or what is it?


texts: Create backup of MySQL database alongside Features module

texts:
When collaborating with other developers, we are using Features module and push it to a repository, this way the files can be pulled to the developer's own development environment.

Our problem is the database.  What we do is export a SQL dump, and send it. Then import the SQL dump.

Is there a better way on handling database backups? Since I believe that Features module can't export the database.


texts: Simplenews send mail when specific content is created

texts:
Required: Simplenews module in drupal7.

I have a content type student on my site. The student can be from department: Engineering, Management,....

What I want to do is whenever I add a student who is from engineering, a mail is sent automatically to subscribed users. I read about the simplenews module and already tried to send some mails which were received successfully.

What I can't do and am not finding information about is how to 'link' the term engineering in department to newsletter and then send a mail.


texts: Is there a Rules Condition for 'is user:' or 'is root user'?

texts:
I am creating a rule that will help to manage permissions, but I only want it to run for the user with uid=1.

Is there a way to add a Rules Condition based on user data? Is such a condition prone to problems, and should I instead need to create a new permission?


texts: dpm breaks only if used in form custom submit on edit node

texts:
Problem

I have a case where the dpm printout is working fine in all cases except on a specific node type, in a very specific scenario.

If I edit the node type and place  dpm($form_state) in the custom node submit called by hook_form_alter, no messages display on submitting the form.

If I create the node it works fine. If I put dpm($form) in the custom node submit it works fine. It's only that exact scenario which breaks.

I've read other questions where dpm breaks, but never for something so utterly and irritatingly specific.

I've cut down my code to:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id === 'mycustom_node_form_id') {
    $form['#validate'][] = 'mymodule_form_validate';
    $form['actions']['submit']['#submit'][] = 'mymodule_form_submit';
  }
}

function mymodule_form_validate ($form, &$form_state) {
  dpm($form_state);
  dpm($form);
}

function mymodule_form_submit ($form, &$form_state) {
  dpm($form_state); <-- THE PROBLEM
}

The node type itself, contains a fairly complex field collection, a bunch of ordinary fields and a fivestar field.

Can anyone provide any guesses or places to begin debugging this? I'm completely stumped.


texts:
I've got a Date field on my content type and I'm using the jQuery pop-up calendar as the widget. The html rendered for it has extra stuff that I'd like to strip away, but I can't find a way to configure what it looks like.

Here's my current Edit form:

Notice with all of the non-date fields, the name of the field is bold and directly above the textfield/select box, etc.

However, with the date field, the field name is not bold, then there is a space, then a bold "Date" and THEN the textbox which is linked to the popup calendar.

I would like it to end up like this:

I understand that I can try to just hack it by hiding things with css, but that's not what I'm looking for.

I'm looking to find a way to configure drupal to render this field the same way it renders all of the others, instead of rendering tags that just take up bandwidth and get hidden by css.

EDIT: This isn't an issue of a special configuration. I just installed vanilla drupal in a new directory. I installed the date module. I enabled the date module along with the date popup module (comes with it). I added a date field to the Article content type and set it's widget type to be popup calendar. Went to add a new Article node and it appeared just like I said above.