texts: Alter view with hook_views_post_render and save results to cache

texts:
How can I alter the results of a view with hook_views_post_render but save the altered output to cache, in order to avoid the overhead of altering the results on every request?

The ideal scanario should be like this: Is the cache expired -> Yes -> alter the view's output -> Save new output in cache, Otherwise don't alter the output.


texts:
I am struggling to sort out how to insert a lot of records using db_insert

Please see below for the code.

I can't have a for loop in the array. It breaks but I am dealing with looping through a lot of data. 48 (states) X 365 (# days) X 36 years.

What is the best way of accomplishing this?

Thanks!

$query = db_insert('HDD')
  ->fields(array(
  for ($s = 0; $s <= $cnt; $s++) {
    'HDDDAYS' => $time, //Loops through the dates
    'AL'=> $output1[$sts[0]][$dts[$s]],
    'AR'=> $output1[$sts[1]][$dts[$s]],
    'AZ'=> $output1[$sts[2]][$dts[$s]],
    'CA'=> $output1[$sts[3]][$dts[$s]],
    'CO'=> $output1[$sts[4]][$dts[$s]],
    'CT'=> $output1[$sts[5]][$dts[$s]],
    'DE'=> $output1[$sts[6]][$dts[$s]],
    'FL'=> $output1[$sts[7]][$dts[$s]],
    ....
    'WI'=> $output1[$sts[45]][$dts[$s]],
    'WV'=> $output1[$sts[46]][$dts[$s]],
    'WY'=> $output1[$sts[47]][$dts[$s]]
  }));
  $query->execute();


texts: How know inside hook_entity_presave() if it's a create or update?

texts:
How know inside hook_entity_presave() if the entity is create or update please ?
Thanks.

Note: I want use presave and not update and insert hook.


texts: Make certain pages available to logged-in users only

texts:
I need some help and here is the issue:

I am building a site using Drupal 7.

I need to make certain pages only visible to logged-in users (each having their own username/password), other users should be simply redirected or shown an error message. Is this functionality maybe included in Drupal 7 itself or is there a module that does this (something simpler than Organic Groups)?


texts: Register only via a specific e-mail domain

texts:
I need to allow users to register for a Drupal-6 site, but only if their email contains a specific domain. For example, only allow users with whatever.com in their  email address to register; a user with the email bob@whatever.com can register for the site, but bob@something.com cannot register for the site.

Is there a module for this? If not, which file would the PHP need to be altered for this?


texts:
I just read in drupal.org site this comment:

A user who doesn't have the vetted role cannot become the only
maintainer, or the project maintainer, of a project that opted into
security coverage, in the same way a user without the vetted role
cannot take over a project that opted into security coverage.

I tried to found what is this on the site without luck and I really don't have an idea.
Does somebody know what means vetted role in drupal.org?


texts: CKEditor is missing when editing a page, but works fine when creating a new page

texts:
On our drupal 7 site, we have CKEditor installed. It works fine when creating new content, but it doesn't activate properly when you go to edit the same page later. It acts like there is no editor installed and just gives a standard textbox with source.

If I click "Edit Summary", it will usually show up for the summary textbox (though not always).

Why isn't CKEditor showing up for the Body textbox?

Note that I am not selecting "switch to plain text editor". If I do, and if I see CKEditor on "Edit Summary", then clicking "switch to plain text editor" does properly hide the CKEditor for the Summary textfield. Clicking "switch to rich text editor" also restores CKEditor for the Summary, but the main Body textbox still acts like it uses a plain text editor.

New Page - CKEditor Showing

Edit Page - CKEditor Missing

Edit Page Summary - CKEditor Showing (but still missing for the body textbox - not shown in screenshot)

Edit: More details on the exact problem
I found that the reason a New Page loads ckeditor, while editing does not, is because the textbox is empty. If I add text to the new page, switch to 'plain text editor', then try to switch back to 'rich text editor', then CKEditor does not load.

Similarly, if I clear out the data in the textbox while editing a page, and switch text editors, CKEditor loads up.

There is a 500 error being returned, causing CKEditor to not load. When there is text, switching to 'rich text editor' causes an AJAX call to the server to validate or otherwise process the textbox data. Since it fails, CKEditor never loads.

But if there is nothing in the textbox, the AJAX call never happens (and thus no 500 is returned), so CKEditor loads up just fine. This is also why CKEditor loads in the Summary: it has no data.


texts:
A plugin that I have written is not being discovered.

For eg : https://www.drupal.org/node/2847639

Is there a general suggestion for debugging failing plugin discovery?


texts: how to show ubercart fields in manage fields section of content type

texts:
I'm needing to access the price, sku, etc fields in the manage fields section in structure/contenttypes. None of these fields show up in the manage fields section? I can manage their display under manage display tab, but I need to be able to manage the field itself in order for conditional fields to affect them.

How can I show these fields in the manage fields section?

Thanks in advance.

Billy


texts: From the Views 3 and weight modules, which features sub-group reordering?

texts:
This question is for users of any solution listed as a Node Ordering Module and used the module in a Views view page (especially Views 3 and Drupal 7) to order list under a sub-category.

The goal is a Views view with a list grouped by taxo/category. The individual items of each category may be reordered on a Views' admin page but only within each category. (for example, if you had a list of albums on a fan site, it would not be correct to move a song from one album to another.)

I already know, Draggable Views does not work in this manner as per the "group by" issue for this module.

Without trying each module, anyone use this "pattern"? Or, is one of these modules a better starting point to hack from (and why)?


texts: Is there a way to transliterate text in Rules Set a data value?

texts:
I am using rules on a bilingual site. How can I use the "Set a data value" action to set data value of another field using tokens but something like this:

$englishKeywords = transliterate([token_name]);
echo $englishKeywords;

Where the token name is the field that needs to be transliterated.


texts: Appropriate way to include a PHP file in a theme tpl

texts:
I guess this is more of a "Drupal way" question than a technical question. I have a multi-site install with a base-theme shared by all of the sites.  The base theme has two 'page' theme files (one is specifically for the homepage).  As you can imagine, there are shared elements to the layout (let's say a header and footer for conciseness). I'd like to keep the 'header' and 'footer' in separate PHP files so that I have one place to edit them versus going into 2 separate files and editing four blocks of code if something changes.

What is the appropriate way to create php files for 'header' and 'footer' and include them in the page.tpl and page--homepage.tpl templates?

Should they be in a folder called includes with a .inc extension, should this not be done at all, etc..?


texts:
I sort of ran into a problem here, for a new project a piece of the homepage can have different layouts.

For example:

-----------------
| N  |    C     |
| E  |    O     |
| W  |    N     |
| S  |    T     |
|    |    E     |
|    |    N     |
|    |    T     |
-----------------

or

-----------------
|       C       |
|       O       |
|       N       |
|       T       |
|       E       |
|       N       |
|       T       |
-----------------

or

-----------------
|               |
|     NEWS      |
|               |
-----------------

So there are 3 types of layouts, news + content, just content and just news.
What would be the best way to do this? Currently I'm using Panels to build the homepage, this is just a small part of it.

It also would have to be very convenient for the user to switch styles, any ideas for this?


texts: How do I change the field title on the "Generate automatic URL alias" checkbox in pathautho?

texts:
How do I change the title of the checkbox "Generate automatic URL alias" on the pathauto fieldset on the node add page?

In my hook_form_node_form_alter I don't see this anywhere in the $form.


texts:
I am creating file entities with migrate using drush. Image files are being copied down from a remote server.
I tried

$this->addFieldMapping('file_replace')->defaultValue('FILE_EXISTS_REPLACE');
$this->addFieldMapping('preserve_files')->defaultValue(TRUE);

If I run the migration with --update it duplicates the files, not replacing existing ones.

drush mi DAProductImages --limit="10 items" --update

When I run this first time it creates the files. Second time it adds _0 to the filenames and duplicates the files. If I rollback after first migration the files are being removed. When rolling back after the second migration only files of last batch get removed. I also tried with:

$this->addFieldMapping('preserve_files')->defaultValue(FALSE);

How can I make it so that I will not end up with duplicates? I have about 30000 images so I cannot afford that.


texts:
I have a rather newbie question, I am following a Drupal 7 module examples, specifically an ajax wizard form. All form creation / manipulation is included in ajax_example_graceful_degradation.inc which when is called in file attribute:

// A classic multi-step wizard, but with no page reloads.
  // See ajax_example_graceful_degradation.inc.
  $items['examples/ajax_example/wizard'] = array(
    'title' => 'Wizard (with graceful degradation)',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('ajax_example_wizard'),
    'access callback' => TRUE,
    **'file' => 'ajax_example_graceful_degradation.inc',**
    'weight' => 7,
  );

Next i would like to create a block which will be included in my template. It seems that i cant include a file attribute in block_view function. How can I do that?
Note: If I include all fuctions of ajax_example_graceful_degradation.inc in .module file then my block works ok.


texts: Extending CKEditor with multiple plugins

texts:
I want to include more features and plugins to the default CKEditor included in Drupal 8.
I found an article explaining how to do so here

https://www.linkedin.com/pulse/creation-extended-functionality-basic-ckeditor-drupal-aleksey-razumov

In the article a module is created to include that specific plugin however I would like to know if there's a way to include multiple plugins from one module. For example I would like to create a module called 'CKEditor Advanced Style' that includes multiple CKEditor plugins rather than having a module for layout, a module for tables, and so on.


texts: In the user page (www.example.com/user), there are [View | Edit] tabs. Is it possible to hide the View tab and leave Edit tab there?


texts: How can I use a replacement pattern in a custom field?

texts:
I just created a new custom field in a view, but I would like to use replacement patterns in that field. Is it possible to do this?

class CustomButtonField extends FieldPluginBase {

  /**
   * {@inheritdoc}
   */
  public function usesGroupBy() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function query() {
    // Do nothing -- to override the parent query.
  }

  /**
   * {@inheritdoc}
   */
  protected function defineOptions() {
    $options = parent::defineOptions();

    $options['target'] = ['default' => FALSE];
    $options['class'] = ['default' => FALSE];
    $options['text'] = ['default' => FALSE];
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&amp;$form, FormStateInterface $form_state) {
    $form['target'] = array(
      '#title' => $this->t('The target id of the button'),
      '#type' => 'textfield',
      '#default_value' => $this->options['target'],
    );

    $form['class'] = array(
      '#title' => $this->t('The class of the button'),
      '#type' => 'textfield',
      '#default_value' => $this->options['class'],
    );

    $form['text'] = array(
      '#title' => $this->t('The text of the button'),
      '#type' => 'textfield',
      '#default_value' => $this->options['text'],
    );

    parent::buildOptionsForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function render(ResultRow $values) {
    return [
      '#theme'  => 'custom_button',
      '#target' => $this->options['target'],
      '#class'  => $this->options['class'],
      '#text'   => $this->options['text']
    ];
  }
}

How can I use replacement patterns in $form['text']?


texts: Overwrite field theme function from within form alter

texts: I'd like to modify the html of a form field from hook_form_alter(). Any hook for this one?


texts: How to send an email with a download link?

texts:
I had installed Webform Protected Downloads. But there are lot of things I don't like about this module:

Too many steps to download files.
The email's body content is only for plain text. You cannot use any HTML tag.

What options do I have to remedy these things I don't like?


texts: Exported field collection field has null UUID

texts:
In D8, I have a configuration management error. I have created a field named 'field_icon_link' of type “Field Collection”. I export my config. If I try to import this config I get a UUID error.

  Unexpected error during import with operation update for
  field_collection.field_collection.field_icon_link: Attempt to save a
  configuration entity ‘field_icon_link’ with UUID ‘’ when this entity
  already exists with UUID ‘b18531e5-8e5a-4708-a0e2-7d7503a2e631’

I inspect the exported configuration file. The UUID is set to null, "uuid: null". Of course the field in the DB has a UUID, so its true, they don't match. I have re-exported a few times, the UUID for this field is always null. Other config files for other fields all have a UUID.

Any suggestions? Are there reasons a field may export with a null UUID or could this a bug for the Field Collection module?


texts: Find the parent node type of the commerce product being added to the cart

texts:
I have a product variation "Apparel", and a corresponding content type provided by kickstart "Apparel".

I have added a new content type "Product kit", which has an entity reference field pointing to "Commerce product" entity and "Apparel" is one of them. A single product kit node, can contain products of different types : "Apparel", "Luggage", "Cups", etc.

Using the newly created Commerce Product Kit module I have an option to add all the products stored in the entity reference field in a "product kit" node to cart.

I need to find a way to check if a product has been added from the "Product display" node or "Product kit" node. Is there a way to do this? I checked into hook_commerce_cart_product_add, but it doesn't help me identifying the source node type of the product. Any pointers would be appreciated.


texts: Boost module's "Cache every page except the listed pages" option

texts:
I use Boost 7.x.
I couldn't use "Cache every page except the listed pages" option.
If i leave the textarea (of exclusion of some pages) everything works well.

In "/admin/config/system/boost" it is written like this:

  Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are blog for the blog page and blog/* for every personal blog. <front> is the front page.

When I add the allowing lines, Boost breaks to cache files.

content/my-alias-1
content/my-alias-2

Am I using the wrong format for writing those lines?


texts: How do I add an #ajax callback to File field form widget?

texts:
I have a content type with a file field: field_file_field . I want to attach a custom #ajax callback to the widget which will execute after file upload.

I have tried with:

$ajax_settings = array(
      'callback' => 'some_ajax_callback',
      'wrapper' => "default-wrapper",
      'method' => 'change',
      'effect' => 'fade',
    );

// All of those 3 I have tried.
$form['field_file_field']['#ajax'] = $ajax_settings;
$form['field_file_field'][LANGUAGE_NONE]['#ajax'] = $ajax_settings;
$form['field_file_field'][LANGUAGE_NONE][0]['#ajax'] = $ajax_settings;

Without success. Any idea ?
I want to change another file in the edit form when upload file.


texts: How to force a JS library to be loaded via HTTPS?

texts:
How can I force a js library to always load only via SSL?
Specifically, I want to get Drupal to always load stripe.js with SSL, because stripe.js refuses to load over http (you get a 403 FORBIDDEN error).
I'm loading stripe.js through the Commerce Stripe module.
commerce_stripe.libraries.yml looks like this:
stripe:
  remote: https://github.com/stripe/stripe-php
  version: "4.3.0"
  license:
    name: MIT
    url: https://github.com/stripe/stripe-php/blob/master/LICENSE
    gpl-compatible: true
  js:
    "https://js.stripe.com/v3/": { minified: true }

So I thought this would be sufficient to always load via SSL.
On my production site, for which all the assets are SSL, everything works.
On Lando, my local development environment, everything is fine when I access my site from a browser installed on my machine, even when the connection to the locally hosted website is http (connection to my dev site is http, connection to stripe.js is https).
However, when using the Standalone Chrome Debug docker image to test my site with Behat, stripe.js doesn't load. I get a 403 FORBIDDEN error because the Chrome browser in the Standalone Chrome Debug container tries to load stripe.js via http.
From the Chrome browser with the problem, this is what the <script> tag looks like for stripe.js:
<script src="//js.stripe.com/v3/"></script>

I'm not sure exactly why I am having this problem only with the Standalone Chrome Debug docker image, but I suspect it is because I cannot access my site via https from the image at all. However, in the browser, I can open other SSL sites such as https://www.google.com and perform a search without any problems.
So,

If I am accessing a local installation of Drupal via docker from inside a docker container
And I do not have access to the Drupal installation via HTTPS
Is it impossible to load a third-party js library (stripe.js) via HTTPS?

The reason I'm confused is that I can load stripe.js locally when accessing my site via a browser in Windows (my dev machine) through http, but in the Docker container (standalone-chrome-debug), accessing my local dev site through http gets a 403 forbidden for stripe.js. (When I manually type the stripe.js library link into the browser, I can download the library, so the problem only occurs with the link/connection generated by Drupal.)


texts: I am working with Drupal 8. I want to add meta tags for title and description for a view. Is there any option?


texts: How to add slider to show multiple view's product in a slider in commerce site of drupal 7?

texts:
I am working on Commerce Kickstart. In my homepage there are 3 views & each view contain 3 product. Each view's products are shown in a column like below image :

I want to add slider to show all products by clicking "< >" arrow. How can I implement. Please Help. Thanks


texts:
I have used the commerce shipping module in my site, now I want to unset the shipping for a particular order.

How Could I achieve this?


texts:
I have a CCK called "Study" that has 2 inline entity referenced fields (Info, Log).
I want to create a node and set that node/entity to the 2nd entity ref field(Log); only when a checkbox option in 1st entity ref field(Info) is selected.

That is,
1st ERfield (Info) has a checkbox question with 3 options. If the user selects 3rd option, I have to create a node/entity and set that node as target id for 2nd ERfield (Log). How do I do this?

My work so far:

in custom validate handler, I check if the 3rd checkbox is selected. If yes, then I call a custom submit handler (inside my custom validate)
In the custom submit, I create entity for the 2nd ERfield and assign it to Study CCK 2nd ERfield. (please find code below for this)
problem facing, entity is created and assigned, but after the form is completely submitted, the entity created is no longer referenced to 2nd ERfield. HOW do I fix This?

/**
 * The custom validation function added to this form.
 *
 */
function study_form_validate($form, &$form_state) {
  // check if 3rd checkbox is selected
  if (in_array('AddToLog', $array)) {
    $form_state['submit_handlers'][] = 'testsubmitfunc';
  }
}

function testsubmitfunc($form, &$form_state) {
  // create Log entity
  $lognode = entity_create('node', array('type' => 'log'));
  $lognode->uid = $form['uid']['#value'];
  $emw_lognode = entity_metadata_wrapper('node', $lognode);
  $emw_lognode->save();
  $emw_lognode_nid = $emw_lognode->nid->value();

  // assign target id to the study entity
  $study_nid = $form_state['node']->nid;
  $study_e = entity_load('node', array($study_nid));
  $study_e[$study_nid]->field_erf_log = array('und'=>array('0'=>array('target_id' => $emw_lognode_nid)));
  entity_save('node', $study_e[$study_nid]);

  // exit();  // just to check if entity is created and assigned => is created and assigned,
  // but removing exit(), and after the node is completely submitted,
  // 2nd ERfield(Log) is no longer assigned. (but the entity created is still there under admin->Content page)
}


texts: Is there a way to selectively export specific relevant configuration into custom modules?

texts:
I'm learning D8 and gaining familiarity with the configuration management aspects of drush.

All my configuration is exported into my config/sync directory and I cherry picked the relevant files and moved them into a config/install under my custom modules.

However, I'm having trouble when I had to rebuild my site due to some vagrant issues and I came across the following type of errors:

  Unable to install Questions due to unmet dependencies: field.field.node.quiz.field_questions (node.type.quiz), views.view.quizes (node.type.quiz, rest, serialization)

Is there a way to selectively export specific relevant configuration into my custom modules directly?


texts:
I am trying to create a custom form in drupal 8. for that I created my custom module called hello , and i've put inside the hello.routing.yml file the folllowing route:
hello.my_special_form:
  path: '/my-form'
  defaults:
    _title: 'My new form'
    _form: '\Drupal\hello\Form\Test.php'
  requirements:
    _permission: 'access content'

Inside Test.php ,
I have only written :
<?php
/**
 * @file
 * Contains \Drupal\hello\Form\Test.
 */
   namespace Drupal\hello\Form;
   use Drupal\Core\Form\FormBase;
   use Drupal\Core\Form\FormStateInterface;
   class Test extends FormBase {

}

I have no errors in my recent log messages, but when I clear cache , the website crashes.I have no idea why specially that I have not written anything yet.
Debugging: If I comment all the Test.php file, the clear cache works fine ! In addition to that, If I only comment the class Test extends FormBase line , the clear cache works as well. so the problem is in the class declaration. Any idea why?


texts: I can't remove an manage_file field image

texts:
I have the next managed_file field:

$form['portada_field']['imagen_portada'] = array(
            '#title' => t('Imagen'),
            '#type' => 'managed_file',
            '#description' => t('Extensiones permitidas: gif png jpg jpeg'),
            '#upload_validators' => array('file_validate_extensions' => array('jpeg jpg png gif')),
            '#upload_location' => 'public://articulos/portada',
            '#progress_indicator' => 'throbber',
            '#status' => FILE_STATUS_PERMANENT,
            '#progress_message' => 'One moment while we save your file...',
                '#states' => array(
                    'visible' => array(
                      ':input[name="checkbox_imagen"]' => array('checked' => TRUE),
                    ),
                ),
         );

After upload an image, If I want to remove the image I can't do it, it appears again

How I can remove it?

Thank you very much.


texts:
I want to rewrite the link text for Flags such that it includes the number of flaggings for that node, as pluralizing the output.

e.g.

1 Flag
3 Flags

I can get as far as getting the flag count and pluralizing the output using a field rewrite, but the Ajax link breaks, and the field can no longer be clicked to flag or unflag the node.

I've tried the dlike module, but this doesn't seem help with pluralizing the flag/unflag link


texts: How to add Google adsense Adlinks at the middle of the post

texts: Hello I need to put adsense adlinks at the middle of the content or between paragraphs but I am not getting any modules to do that.Currently i use Content Injector to display image ads at top and bottom of the post.


texts: Q how to enter API functions in wsclient rest server setting?

texts:
I need to add functions from an SDK API reference document to the Drupal7 webservices rest server. I'd like to query them through the wsclient rest server, attached to a feed, to input them as analytics into the node of the content they are viewing at the time.

Eg one of the API references listed (which I want to use is);
Float AffGetEScore()
Description:
Returns EB level of the user.
Parameters:
Returns:
EB level (0.0 to 1.0).

I have created a field in my node (type 'float') labeled 'AffGetEscore' and set up the wsclient. Now how/where does this function get entered in the Drupal webservices rest server settings?Where can I find 'Escore' in my settings to select? How/where do I enter this function in the wsclient settings? Thank you so much- would very much appreciate any guidance/ help you can give.


texts: Custom block with configurable message inside it

texts: When creating a custom block, how can we add a message and have it configurable by the user?  Is this possible?


texts: Translate en entity type created with eck - argument in menu

texts:
I am trying to use an entity type created with Entity Construction Kit together with Entity translation. There are some issues, i am trying to resolve them ...

the fatal error on entity view was easy
but the other one is a little more tricky :

Eck constructs its menus with both the entity type and the bundle type in the path, so the proper menu entries for translation aren't created.

I tried a workaround adding this into my feature (currently i only have 1 bundle anyway) :

function my_feature_translation_info($types = NULL) {
  $info['mytype'] = array(
    'translation' => array(
      'entity_translation' => array(
        'base path' => 'mytype/mytype/%',
      ),
    ),
  );

It helped to show the translation tab, but the tab didn't work, because eck doesn't use the "magic placeholder processing" and the entity_translation callback is supposing that the entity be loaded by that.

Another attempted workaround is to create a menu path (the common "node/%node" pattern according to translation code comments) as it is supposed in entity_translation_entity_info_alter, with a loader

  $items['mytype/%mytype'] = array(
    'title' => '',
    'description' => '',
    'page callback' => 'eck__entity__view',
    'page arguments' => array('mytype','mytype',2),
    'type' => MENU_NORMAL_ITEM,
    'file' => '../../contrib/eck/eck.entity.inc'
  );

function mytype_load($id) {
  $ea = entity_load('panelco', array($id));
  return $ea[$id];
}

This is almost good : the translate path works ! My newly defined view path (mytype/1) doesn't , failing with

  Undefined index: in eck__entity__view()

, which is currently beyond my understanding.


texts: How to add extra field after caption and title on images

texts: Is there a way with Drupal that I can add more fields on the one of caption and title when uploading images?


texts: What can I use for something like Google web analytics for a Drupal website?

texts:
I'm looking for my site to use web analytics so I will be able to track inside my backend on whats going on inside my web.

I am looking for something like Google Analytics but just on Drupal.


texts: How do I make more block for Bootstrap theme?

texts:
My bootstrap theme block region look doesn't have much block section.

How do I make this like the second image? How do I make more block.


texts:
Wondering how i can control the markup returned for a Rendered file view mode?

This is within a view, i have a field which is a media file image. I set it to use the Rendered File formatter and provide a view mode i created. But i don't see where i can customize the view mode markup.

msvu.jpg

The only markup I want returned is

I want to get rid of the div's and the whole h2 element.


texts: Variables available on display suite php field

texts:
I'm using Display Suite module to create custom fields.

I've to add a code field (php), that calls a function that has $nid as argument. I've added this field to node entity but I can't understand if there are variables available on this field.

Adding a php field I've a textare where I can add php code.ù
I've a custom functions that retuns html and require a nid as argument.

so in my custom field I should have something like:

<?php
print my_function($nid);
?>

The problem is that I don't know where find the $nid: $object? $node? $entity? $context?

This field is added on an node entity.


texts: copy content-profile elements to another page

texts:
In my content profile page, I have a set of three elements:  a search field, a set of checkboxes with data, a text area that shows the chosen options. I also have a number of onclick and keyup functions defined in a .js file, that fills the checkbox options, makes sure that entering values in the search field scrolls to the nearest checkbox, and when user checked a value it appears in the text area. So far so good.

How do I "copy" these elements and their functions to a separate page? I want a new page called "update my data" that has the exact same elements and functions, and I would just need to change the submit function. I am new to Drupal and Javascript, so sorry if this is a stupid question...

I tried using the content-profile update page and it doesn't copy the event handlers. Also, it allows the user to update all their data and I want only these elements.

I am using Drupal 6 and Content Profile module.

Thanks!


texts: How can I react when a commerce product is explicitly created via the UI?

texts:
how do we add a submit handler in drupal commerce everytime a product is created.

I tried using the following code.

function custommodule_formid_form_alter(&$form, &$form_state, $form_id) {
    $form['#submit'][] = 'custom_submit_function';

    return $form;
}

function custom_submit_function() {
    print "<pre>";
    print_r($form_state);
    print "</pre>";
    die();
}

Is this the correct way?

I tested it, and actually managed to get the form submit new handler works, but the problem is after the form is submitted, I wanted to get the submitted data and manipulate it. It is not working out as the form data is all gone.

function custommodule_form_alter(&$form, &$form_state, $form_id) {
    $form['#submit'][] = 'custom_submit_function';
}

function custom_submit_function($form, &$form_state) {
  $value = $form_state['values']['field_data'];
}


texts: Variable created in hook_preprocess_node is not available to template

texts:
I have this preprocess function in my theme:

function hotness_preprocess_node(&$vars) {
  $node = empty($vars['node']) ? FALSE : $vars['node'];
  $vars['hotness_is_article_page'] = ($node && node_is_page($node) && $node->type == 'spot') ? TRUE : FALSE;
}

The other stuff I do here (not shown) works fine. However, I get an undefined error when I try to use $hotness_is_article_page in my theme tpl files (specifically region--branding.tpl.php). I am using Omega, if that matters.

For some reason I only seem to be able to create variables accessible in tpl files in my hotness_preprocess() function, but not page or node hooks. This is not ideal, as hotness_preprocess() runs several times per page load.

What am I doing wrong?


texts:
I installed Drupal on ubuntu 16.04 via composer and I'm trying to implement continuous integration with Jenkins. So, I would like to be able to work from another location (for example from a Windows 10 PC), and a push of my changes must trigger a build on jenkins that updates the installation on the ubuntu machine.

I verified that the created .gitignore file is this:

# Ignore directories generated by Composer
/drush/contrib/
/vendor/
/web/core/
/web/modules/contrib/
/web/themes/contrib/
/web/profiles/contrib/
/web/libraries/

# Ignore sensitive information
/web/sites/*/settings.php
/web/sites/*/settings.local.php

# Ignore Drupal's file directory
/web/sites/*/files/

# Ignore SimpleTest multi-site environment.
/web/sites/simpletest

# Ignore files generated by PhpStorm
/.idea/

# Ignore .env files as they are personal
/.env

So after having pushed the code into my git repository, I noticed that various folders are missing such as the "core" folder and I do not think that the project can work if the "core" folder is missing.

Do I simply have to update the .gitignore file? Or is there anything I need to understand better about the "modus operandi" in Drupal?


texts: How can I add custom content to a Drupal 6 menu?

texts:
1) Currently I have drop down menus for primary & secondary links. They need to now be mega-menus, and need to include the item teaser as well as the link:

  Link 1

Teaser for this link

2) We also want to include webforms or any content in a menu list item. I am hearing that blocks are the way to go, but again, am a bit confused.

Can anyone help?


texts:
My question is about how to show the entire book navigation tree in a block (drupal 8)

Thanks to @oknate we can have a Book Navigation block with the top level book showing, But i need the whole tree. (think table of contents)

All the folowing examples assume you are are the top page of a 3 level deep book.

Also, I have a working module at https://github.com/petergus/alt-book-nav.git

Showing the title (top level) book in the book navigation block is done by replacing the following in book/src/Plugin/Block/BookNavigationBlock.php (with a custom module of course)

 // Only show the block if the user has view access for the top-level node.
  if ($nid) {
    $tree = $this->bookManager->bookTreeAllData($node->book['bid'], $node->book);
    // There should only be one element at the top level.
    $data = array_shift($tree);
    $below = $this->bookManager->bookTreeOutput($data['below']);
    if (!empty($below)) {
      return $below;
    }
  }

with

     if ($nid) {
        $tree = $this->bookManager->bookTreeAllData($node->book['bid'], $node->book);
        return $this->bookManager->bookTreeOutput($tree);
      }

That only shows the top level and child level though, I want to be able to view the full tree from any page.

I am completely new with drupal 8 and not very handy with PHP so all i could find out was that

     $tree = $this->bookManager->bookTreeAllData($node->book['bid'], $node->book);
     kint($tree);

returns only the book name and first level
and

     $tree = $this->bookManager->bookTreeAllData($node->book['bid']);
     kint($tree);

(without the $node->book) returns multiples levels, that is, multiple 'below' arrays.

I have no idea how to go further with pulling that information into the block, does someone?

As mentioned above, I have the module that @oknate suggested at https://github.com/petergus/alt-book-nav.git

Greatly appreciating any help, and hoping this questions serves the community.


texts: Can I setup a backup migrate schedule from settings.php

texts:
I am using Pantheon to host a development, staging and production drupal 7 site.  I have backup migrate module setup to perform period backups. When I migrate the production site's content to the staging site for testing of new features, the backup migrate settings come with, and all of sudden I now have both production and staging servers backing up to a remote server.  I don't mind having to delete the schedules every time I perform the migration, however I'd hate to write this step into the SOP for other developers as they come on the project.  So is there a way to setup a backup migrate schedule in settings php?  My only thought is to add some config variables in settings.php, and then create a custom module that builds a backup migrate schedule based on these config variables.  I feel like there could be a more elegant solution than this.  Any thoughts?

Thanks


texts: How can the divs added by default by Views be removed?

texts: In Views module, if I don't use any classes, even not the default, it still insists of wrapping the field contents into divs. I have had to use views-view-fields--VIEW-ID.tpl.php to theme the content, when it would had been very easy to tell Drupal not to warp with divs. Surely I am doing something wrong in the UI of Views, but I cannot identify what: in each field, the Style Settings has every checkbox unchecked, even the "Add default classes" checkbox.


texts: Problem installing in local "The translation server is offline"

texts:
I'm trying to install Drupal 8 on my laptop (localhost on a WAMP server), and I always get the following error in the first steps:

  Requirements problem

  The translation server is offline.

  The installer requires to contact the translation server to download a
  translation file. Check your internet connection and verify that your
  website can reach the translation server at http://ftp.drupal.org. Check the
  messages and try again.

That step is mandatory, and I can't continue the installation process. Opening http://ftp.drupal.org, I can see the website with no problem.

I've disabled anti-virus and firewall, and I have tried the process from different locations (different Internet access) on the same computer, with the same result. I'm using EasyPHP WAMP on Windows 8.1, with versions that meet the requirements of PHP, MySQL.

What can be blocking the access to the translation server? Is there any way to omit this step?


texts: Smart quotes creating a problem with anonymos user role

texts:
I have create a view. The content of the view loads fine when logged in as admin. But in some of the content when you copy paste from MS Work, certain characters changes.

For e.g. " becomes “

Now the content which contains such characters is not displayed in that view.

But when logged in as admin, I see those content. What could be the problem ?

I checked using devel. The number of results which are fetch is different. Those with special characters are not fetched when viewing as anonymous user.


texts: Managed file validation on first upload only

texts:
In D7,I have new_form with a managed_file field to allow my user to upload documents to public://. I'm trying to prevent my user from uploading a document if the file name they are trying to upload already exists in the system. So far I've been successful using this:

function mymodule_file_validate($file) {
  $filename = $file->filename;
  $errors = array();
  if (file_exists('public://' . $filename)) {
    $errors[] = t("File exists already!.");
  }
  return $errors;
}

This displays an error if the user browses for the file and presses upload, even before the file submission, which is exactly what I need.

However, I also have another form modify_form in this module that allows users to modify the document and in that case it's okay to upload the document with the same name even though the file name exists already. BUT... the function above blocks my modify_form too.

Any suggestions how to make the function apply only to my new_form? Or another way to prevent upload if file exists already only on new_form? Thanks!


texts:
Updated Drupal from 8.7.8 to 8.8.0 with:

composer update --with-dependencies

That part went well, but when I run:

drush updb

I get following error:

In ProcessBase.php line 188:

  Unable to decode output into JSON: Syntax error

  Error: Call to a member function getConfigDependencyKey() on null in Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid-
  >calculateDependencies() (line 394 of /var/www/html/drupal/web/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndex
  Tid.php).

Checked the code a bit and it goes like:

  public function calculateDependencies() {
    $dependencies = parent::calculateDependencies();

    $vocabulary = $this->vocabularyStorage->load($this->options['vid']);
    $dependencies[$vocabulary->getConfigDependencyKey()][] = $vocabulary->getConfigDependencyName(); // <-- line 394

...

And $this->options['vid'] is empty and $vocabulary var becomes null.

Any idea what's wrong here?


texts:
I just started using Drupal today and I couldn't help but notice (or I'm blind) there is no way to add a sub directory style URL besides using an alias. I want to have a category, for example, named "lessons" and then the next part of the URL would be the title of the lesson.

e.g. http://www.example.com/lessons/lesson1

It just seems like there should be a better way to accomplish this rather than using aliases manually. So my question is, is there a way to do this without aliases? I mean automatically so when I add new content (an Article), I can select the appropriate category it should be in. Thanks


texts: Trigger the 'add more' button with javascript, to add a set amount of field values

texts:
Is there any way to add a certain amount of field values to a standard node add/edit form (when unlimited option has been chosen) using a select input?

At the moment I have this working using javascript by triggering click on the 'add another' button, waiting a bit using setInterval (as the button disappears), then looping as many times as I need to, so the new fields gradually appear. This sort of works, but is very very dirty. Is there any proper way to add a certain number of field values based on a select option, and doesn't involved waiting?


texts:
I want to be able to add a gallery for each user.
I understand how to create a content type. I considered building an image content type. I then thought I could add a view which would only display each user.

Is this best practice for creating a gallery for each user?

I am using Drupal 7, if this makes any difference.

I can get it working in a view but it doesn't seem to work in a block


texts: Views Escaping Special Characters in URL

texts:
I am creating a view with a list of titles that link to the relevant full article that is also displayed via a view.

The view that contains the article has a contextual filter which contains the Title and the of the views is "mysite.com/%"

So the article that is named "hello world" will be found at "mysite.com/hello-world"

However if the article has the ' special character in it for example "Children's Book" the link that I create to point at the article will be "mysite.com/Children%26#039;s-Books" which brings back an empty result.


texts: save and generate pdfs nodes with options

texts:
I have a view that list a content type A with few fields,
For PDFs generation I choose views_pdf it works perfectly and it can generate for me pdfs with the desired fields.

Im behind two problems now that I don't know how to solve them :

I want to save the PDF in my server first, so when the user click on pdf link inside the view, it save the PDF first then download it.
The PDF should be generated following options chosen by user : "download a short version", "Download a long version", ...
( inside the view I thought to make different links and for each option I create its own view. is it the best idea, or I can pass arguements to the pdf ? )

What's your advice, should I continue with views_pdf or I must switch to pdf for example...

Thanks in advance for your suggessions.


texts: Is there a Drupal 6 equivalent to template_preprocess_taxonomy_term()?

texts: Is there a Drupal 6 equivalent to the method template_preprocess_taxonomy_term()? I'm looking to add some code that will provide some additional links on my taxonomy term pages and want to keep the code in template.php (don't like code in my templates themselves).


texts: Automating module activation during installation of Drupal

texts:
I want to add some modules in an installation profile, so that they are automatically installed during installation. Some modules need to be configured before using them.

Is it possible to do it?


texts: path alias or real path has higher priority?

texts:
By default in Drupal , a views create to show all term , its Url is taxonomy/% (%=termid),I has special vocab that I want set another views with my fields and style , I set path alias to that vocab  to cast/term/[term:tid]  and  I create a optional views ,views url path is cast/term/% , (and get % with contextual filter, it is not important because every thing is views is ok) , my problem is where access (as example)  cast/term/21 , it show me the result of taxonomy/% views result not my views.
I think this happen because Drupal default views work with Url and I work with alias of that Url and work with raw Url has higher priority,I want to know what is the exact reason of this job, and how can achieve my job?
(I have A idea that work with hook_menu_alter or set menu with hook_menu in my custom module and in call back of it call my views)
appreciate any help and idea


texts: Drupal commerce: Save into a customer profile field

texts:
im trying to save into a customer profile field. Reading it out is no problem:

if(!empty($order_wrapper->commerce_customer_billing->field_shop_annotations)) {
$annotations = $order_wrapper->commerce_customer_billing->field_shop_annotations->value();
}

But saving into gives me an error message. Here's my code:

// Save annotations
$order = commerce_cart_order_load($user->uid);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$annotations = $form_state['values']['annotations'];

$profile_id = $order_wrapper->commerce_customer_billing->profile_id->value();

$profile = commerce_customer_profile_load($profile_id);

if ($profile_wrapper = entity_metadata_wrapper('commerce_customer_profile', $profile)) {
   // This gives me the error message:
   $profile_wrapper->commerce_customer_billing->field_shop_annotations->set('muh');
}

Everthing works fine except the set method inside the if clause. I also tried:

$profile_wrapper->commerce_customer_billing->field_shop_annotations->value = $annotations;


texts: Show related Content type content in block filtered by category

texts:
I have a Content Type called "All Documents", this uses a Category called "All Categories". Within "All Categories" I have multiple sub-categories eg "Sales", "Parts" and "Service".

I have a block that displays the related content of "All Documents" but this shows everything in that Category. How do I filter so if I am viewing "Parts" it will only show content related to that sub-category?


texts:
Our organization's style guide expects dates in this format:

  Oct. 31 2018 01:30 p.m.

I looked the date format drop-down in our views, and there were several options, including a custom one. However, I noticed that none of these are able render the post meridien with abbreviating periods.

There is option for a custom date format, but it seems to use the encoding for PHP date() function. Looking at the manual, there is a, which gives me pm, and A, which gives me PM, but I don't see anything specifying one with periods.

I looked in the code base for where date formatters are stored, and they all seem to be yaml files specifying date() formats:

$ cat core/modules/system/config/install/core.date_format.html_yearless_date.yml
...
pattern: m-d
...

So it seems that the built-in custom date formats are limited to what can be specified with PHP's date() function.

I googled for ways to create a custom date format, but only found explanations of where to specify a custom date format: https://www.ostraining.com/blog/drupal/d8-dates/

How can I create a date formatter where I can use PHP code to give myself a date format with properly abbreviated meridiens?


texts:
Using Userpoints module for Drupal 6, how do I create a table that shows the points balance for all users, when they got credit or debit of points, and who did it?
Is there any special module that can do that?


texts: Taxonomy reference with sub-fields data entry

texts:
I am working on a Recipe node type which has a taxonomy reference field to my Ingredients taxonomy.
The ingredients reference field is set to "Create referenced entities if they don't already exist" and unlimited.
In the ingredients taxonomy, I added a measurement field,
My problem is in the recipe node creation process. When a new Ingredients term is being created, is there a way to expose the measurement and any other field ?
So, if I type in the name of an existing recipe, I can select a matching option from the autocomplete list.
However, when there is no matching option, I would need to fill no only the term name but also the term field(s) i:e measurement.
I would appreciate any insights and help.


texts:
I'd like to add my own JS functions to the Commerce "add to cart" form when a user makes selections on various product attributes.

When the user clicks through the options available, I need to scan the form using JS for the current values of the radiobuttons/selects.  I need this to happen as soon as the form elements have changed.

edit:
Having some success with the following, however since the form changes every single attribute this makes my javascript function run many, many times.

(function($) {
  Drupal.behaviors.watch = {
    attach: function(context, settings) {
      //look at form values here.
      //this fires after each form element is updated

    }
  }
})(jQuery);

Forgive me if this question sounds a bit lazy, I am reading the documentation, but I've not seen anything yet.


texts: Javascript link in theme.info not working Drupal 7

texts:
Why is my jquery.js file not found when I use this code in my theme.info?

Im using drupal 7.

scripts[] = js/jquery.js

I got this code from the drupal page and I'm 100% sure its the right path.
what did i do wrong here?

Thanks for helping!


texts: How to let users allow other users to view specific node content?

texts:
I'm using Drupal 9
I would like users to be able to allow other users to view their node content. Ideally a user will request access to view the content and the content owner will grant them view access.
How would I go about that?
I've looked at Nodeaccess, but it doesn't seem ready for Drupal 9 yet.
Node access user reference has nothing close for Drupal 9


texts:
I've got two langagues enabled on a Drupal 7 test site, English (set to default in admin/config/regional/language) and Finnish. Under 'Detection and Selection' URL and Default are checked, and URL is set to look for a path prefix.

I've 'translated' (i.e. run through Google Translate) one content item and can switch between the two versions by adding or omitting 'fi' to the path. However, on the front page list of content items the Finnish version is displaying, when I'm expecting to see the English one.

Does anyone know what I'm likely to have messed up or overlooked?

Toby


texts:
this is my hook_form_alter function for set the placeholder attribute and other stuff:

 function mysubtheme_form_alter(&$form, &$form_state, $form_id) {
    switch ($form_id) {
        case 'contact_site_form':
            $form['tel'] = array(
                '#title' => t('Tél'),
                '#type' => 'textfield',
                '#required' => TRUE,
            );
            if ($form_id == 'contact_site_form') {
                $form['name']['#title'] = t('name/family name');
                $form['name']['#attributes']['placeholder'] = t('Enter your name');
            }
                $order = array(
                '1' => 'name',
                '2' => 'mail',
                '3' => 'tel',
                '4' => 'subject',
                '5' => 'message',
                '6' => 'copy',
            );
            foreach ($order as $key => $field) {
               $form[$field]['#weight'] = $key;
            }
            break;
       }
  }

why don't set the placeholder attribute for contact field?

kpr() for this element shows:


texts: Don't render html.tpl.php for a specific path

texts:
Is it possible to load page content without rendering html.tpl.php? I mean on default Drupal has the follwoing:

Html.tpl.php --> Page.tpl.php -->...(etc.)

my goal is to remove Html.tpl.php for a custom path (site://ajax-unesco)

so:

page--ajax-unesco.tpl.php --> ... (etc.)


texts: HTML Mail not working with custom module

texts:
I have installed HTML Mail and Mail System modules and set them up with a template.. this is working fine when I send the test email it uses the template.

However when I send mail from my function, it doesn't use the template.. it was my understanding this should happen automatically, but how can I force it?

I have a mymodule_mail function that just does a switch on $key and fills $message based on various types of messages the system sends.

I call it using drupal_mail().. and that's working, but not loading the template file.

So I added this line above where the mail is being dispatched:

mailsystem_set(array(mailsystem_default_id() => 'HTMLMailSystem'));
drupal_mail('mymodule', 'notification', $email, user_preferred_language($user), $params);

Then I tried moving the mailsystem_set to inside the mymodule_mail function.

and it still isn't working. What am I missing??

drupal_mail has a module parameter that I'm using to call my own module that processes the different templates based on database calls etc. I'm wondering if I have to use that to call HTMLMailSystem, but I need to call my own first. (and still thought using the HTMLMailSystem would be the default)


texts: Preferred way of adding new setting to all fields in a View?

texts:
I'd like to add a new setting to all fields in Views. In other words, when you click on any given field in the "Fields" list, you get a popup with the selected field's configuration options. I would like to add a new settings element here.

If this was just about adding a new setting to a specific custom field handler, then I would just create a new field handler class and have it extend views_handler_field. Then, I'd make my setting available by first defining it in option_definition() followed by adding a new form element in options_form(). However, I'd like the new setting to appear for all fields regardless of field handler.

What I've done so far is to simply provide an implementation of hook_form_views_ui_config_item_form_submit() to add the new setting. I'm adding my custom form element here as well as my own submit handler. In the submit handler I make sure to save the setting in $form_state['handler']->options in my submit handler.

However, is that the right way to go about it? Is there another way which Views facilitates and which would let me do things a little more clean so that I do not have to "mess" with the options array in my own submit handler, but rather have Views to actually know about my added universal field setting?


texts: URLs getting duplicated for the same node

texts:
Yesterday, I found a strange behavior with my drupal site. I noticed all the nodes are getting duplicated like this:

Original node's url will be

  www.livesite.org/?q=node/2

And when I append the url with the somerandom name like this

  www.livesite.org/randomname/?q=node/2

The same page gets displayed but with broken images and logos.

I'm sure there might with the my template's template.php file, but I'm not sure what to edit. Does anyone came across this issue?


texts: Adding Google Map via iframe with CKeditor in an article

texts:
I want to add to the body of a Drupal node (in my case the default article), the google iframe to embed one map

<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3! ... </iframe>

I use Drupal 7.26, CKEditor as Wisywig editor with the "Standard Package", and everything is working fine.

What I tried after reading many articles:

I set the node to Full Html (of course)
I unchecked "Limit allowed HTML tags" in /admin/config/content/formats/full_html
I put "Use custom formatting options"  to yes in the "Cleanup and Output" section of admin/config/content/ckeditor/edit/Full
... few combination of the above.

What it happens: I edit the article, I insert the html source in the body. I untoggle the source button, everything is disappeared (I go back to source and nothing left).

Note: I don't want to use OpenLayers, I don't want to install modules such Iframe, or SimpleMap, because I just need this map once. It should be working, but my html is still filtered for some reason.


texts: How can 'programatically' configure my site?

texts:
I often find myself re-creating the same site: a 'clean' instance of what I have developed so far. It takes me several hours to do. So, I have created a .install file to create all of my content types and fields when I install the first of my custom modules. I also need to:

Create two menus
Configure some blocks
Configure the user permissions
Alter some of the default theme settings

What is the best approach to achieving the above 'programatically'? At the moment I do all of these tasks through the various user interfaces, but like I say it's time cosuming to keep doing it every time I want to start afresh.

Thanks


texts: How can you filter out other languages Taxonomy Terms from an exposed filter?

texts:
I am working on a View for a content type which has a Taxonomy Term field.  The vocabulary is setup with the Translation mode 'Translate'.  The terms have all been translated so that the terms explicitly set Language (currently English and Spanish).  The View has an exposed filter for this field and its showing both languages terms.  How can I configure Drupal to only show the taxonomy terms for the current users language?

Relevant installed modules: Internationalization (i18n), Views translation (i18nviews), Taxonomy translation

I've read a lot of forums about how to get more languages terms to show, just not how to filter them out when you don't want to show them all.


texts: What is the way to restrict access to a store and its products by user?

texts:
I'm using Commerce 2 and I have:

User A and User B
Store X assigned to User A (by entity reference)
Store Y assigned to User B

I would like to restrict access to products of stores so that User A only sees products associated to Store X.

What is the way to do that?


texts: How to export Group module entities with the Features module?

texts:
I'm trying to find a way in D7 to export groups created with the Group module using the Features module. I have managed to export Group Types and Group Roles, but haven't found a way of doing the same with Groups.

I need to do this to create an initial set of groups when the feature is enabled.

Any help greatly appreciated!


texts: Relation vs. References vs. Entity Reference for managing node-reference-type relationships

texts:
References
Entity Reference
Relation

It seems like there are several active modules that all have similar functionality. Can anyone offer any information as to which branch appears to be the most promising / likely to survive & thrive? Any advice is welcome.


texts: Composer require drupal/ packages doesn't work

texts:
If I run...

composer require drupal/token

...I get...

Could not find a version of package drupal/token matching your minimum-stab
  ility (dev). Require it with an explicit version constraint allowing its de
  sired stability.

Not sure if this is relevant, but token is already installed in my site, but is not required in composer.  I want to require (and upgrade) the module with composer.

Changing my minimum stability from dev to stable does not resolve the problem.

I am having the same problem with other modules when I try to run 'composer require'.  Composer always responds with "Could not find a matching version of package..."

Here is a question I posted earlier today that may be related: Composer doesn't see that updates are needed


texts: What about Drupal Commons 3 on Drupal 7?

texts:
What about Drupal Commons 3 on Drupal7?

Its still in alphas and betas for months. Is it worthwhile waiting till it mature? Or is progress already stalled?

At the time Commons 3 on D7 (1.0) comes out Commons 6 will be at least 2.15 (its already 2.11). Should I go with already matured Commons 2.11 or wait for the delaying Version?


texts:
I am working with Drupal 8. I have a view page and added a twig for that.

I want to call a block inside my view page. How can I do that?


texts: Handling mobile images in responsive theme

texts:
Sorry for the open-handed nature of the question, but I don't know where else to get an answer to this. I'm deciding whether or not go full-force into a responsive Drupal 7 theme, probably the Omega framework.

One issue that keeps nagging at me is that the mobile devices have to download all the large images (not to mention everything else...).

Is there an easy way to serve up smaller images for mobile devices?


texts: How can I set a custom error page for database fatal error uncaught exception

texts:
Every once in a while when I get a fatal PDO error, Drupal outputs the page without the theming and outputs the error message onto the screen. On my production site, it just outputs the page without the error message since I've disabled error reporting in php.ini. Still, I'd like that ugly looking themeless page on my prod site to be themed and informs users an error has occurred and assure them it is reported to the webmaster.

I tried creating a maintenance-page.tpl.php and maintenance-page--offline.tpl.php files and placed them in my general theme folder where all the other templates are, but it doesn't seem to get called. I also set error reporting to "none" in the admin/config/development/logging but it still outputs the error.

Any pointers would be greatly appreciated!!


texts: Unable to collect end date after field is saved

texts:
I've been running a d7 site for a couple months and one of the content types has a date field. Initially I opted not to collect and end date but the need for it has arisen. As you may know, there's a design decision in d7's field api that forbids you from changing field settings after it's been saved.

The problem is that I have a very considerable amount of data on a fairly live site, which means it's extremely hairy to do something like deleting the field and then somehow herding all the data back in. Has anyone ran into this? How did you solve it? Any insight at all? Thank you :)


texts: Integrating dropdown menu of different views options on a page

texts:
I have one content type called 'images' - at the moment they are just displayed as a list. However I want the users to have some options on how to view those images.

What I have done:
I have created 3 different Views that have different slideshow settings

What I need help with:
I need to have these 3 options appear automatically when any node from that content type is viewed as a dropdown with label: "View images as:"

Most importantly the different views need to be generated programmatically using the images on that node and not by creating 3 slideshow for each image page!!!


texts: Add Google Analytics to track a button press

texts:
I have the Google Analytics module installed with Drupal 7.  On a page, how would I track the press of a button with id "myButton".  There's a great example here:

https://developers.google.com/analytics/devguides/collection/analyticsjs/events

but I'd like to learn how to leverage the GA module in Drupal 7 to do this.


texts: How to change order and depth of user account tabs

texts:
With Tab Tamer we can change the weight/order of tabs in the user account under user/% (e.g. put user/%/edit after user/%/some_settings), but we can't set depth between the tabs (e.g. user/%/some_settings under user/%/edit/some_settings).

With User Tabs we can create some depth at least for user/%/edit (makes it as a subtab of Account), but it doesn't offer options to put other tabs as subtabs of Account.

So how to transform tabs to subtabs in the user account?


texts:
I have a dropdown in a node and the id of the dropdown is "field_b_status".
I want to add condition in a rule if the drop down value is equals to one of the value "Complete" then send email.
When i try to add that, i see the error.
Data selector field_b_status.value for context Data to compare is invalid. Unable to get variable field_b_status, it is not defined.
Please see the screenshot:

Can you please help me how to add dropdown "field_b_status" in the condition?


texts: How to implement hook_field_widget_form() for multiple fields?

texts:
In a module I'm going to implement some Field types using Field API.
this is how hook_field_info() looks like in my module.

function myModule_field_info()
{
  return array(
    'type1' => array(
      'label' => t('Custom type 1'),
      'description' => t('Just for test'),
      'default_widget' => 'type1_textbox',
      'default_formatter' => 'type1_rawview',
    ),
    'type2' => array(
      'label' => t('Custom type 2'),
      'description' => t('Just for test'),
      'default_widget' => 'type2_textbox',
      'default_formatter' => 'type2_rawview',
    ),
  );
}

and the hook_field_widget_info() implementation is :

function myModule_field_widget_info()
{
  return array(
    'type1_textbox' => array(
      'label' => t('Text field'),
      'field types' => array('type1'),
    ),
    'type2_textbox' => array(
      'label' => t('Text field'),
      'field types' => array('type2'),
    ),
  );
}

off-course this is just an example and each widget has its especial form . now consider that each of my field types has more than one element .

Field type 1

first name
last name

Field type 2

phone number
address
email

now the question is how should I implement widget form for a multiple field type like this?

I tried this code but no chance :

function myModule_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
{
  if($field['cardinality'] == 1){
    $element['#type'] = 'fieldset';
  }
  switch ($instance['widget']['type']) {
    case 'type1_textbox' :
      $type1 = array();
      $type1['firstName'] = array(
        '#type' => 'textfield',
        '#field_prefix' => t('First Name : '),
        '#size' => 20,
        '#default_value' => isset($items[$delta]['firstName']) ? $items[$delta]['firstName'] : '',
      );
      $type1['lastName'] = array(
        '#type' => 'textfield',
        '#field_prefix' => t('Last Name : '),
        '#size' => 20,
        '#default_value' => isset($items[$delta]['lastName']) ? $items[$delta]['lastName'] : '',
      );
      $element += $type1;
      break;
    case 'type2_textbox' :
      $type2 = array();
      $type2['phoneNumber'] = array(
        '#type' => 'textfield',
        '#field_prefix' => t('Phone Number : '),
        '#size' => 20,
        '#default_value' => isset($items[$delta]['phoneNumber']) ? $items[$delta]['phoneNumber'] : '',
      );
      $type2['address'] = array(
        '#type' => 'textarea',
        '#field_prefix' => t('Address : '),
        '#size' => 60,
        '#default_value' => isset($items[$delta]['address']) ? $items[$delta]['address'] : '',
      );
      $type2['email'] = array(
        '#type' => 'textfield',
        '#field_prefix' => t('Email : '),
        '#size' => 20,
        '#default_value' => isset($items[$delta]['email']) ? $items[$delta]['type2']['email'] : '',
      );
      $element += $type2;
      break;
  return $element;
}

The code was edited and now no widget is shown in node-edit form and when I went to field management section this error is appearing


texts:
How to you check that a field is empty, when you have the $node object?.

I found this as possible solution:

$field = field_get_items('node', $node, 'field_post_image');

I can check now:

UPDATE.Ups! This not reliable, althought I promise that it worked for me yesterday.

isset($field);

but I wonder if there is a better way.

Enlighten me


texts: Control content access based on field value in user profile?

texts:
I have two specific user types on my website: "Manager" and "Employee". I will have ten managers and 100 employees. Each Manager will manage 10 employees.

Employees will have permissions to create "Content Type A" nodes. I want their managers to be able to edit/view only those "Content Type A" nodes that were created by their employees.

I created a User Reference field in the profile form. that UR field is populated only with the names of the Managers. When a new employee is registered their manager's name will be selected from that UR field.

I feel like I should be able to control each Manager's access to Employee-created content based on that UR value in each employee's profile, but I can't quite wrap my head around how to accomplish that. Would Views be the best bet, or would I need to develop a custom permissions module that compares the logged-in Manager's UID with the UID related to the Manager selected in the UR field on the employee profile? Or perhaps some kind of Rules setup?

Thanks!


texts: How do I load a field of a product in a custom module?

texts:
A customer want to have the possibility to use different discounts on products. I'm working with the price resolver and I'll give the possibility to manage different discounts with taxonomy terms. I added an entity reference field (field_discount) to the product.

I'm writing the module that should look which discount is given to the product and then calculate the price based on the discount.

How can I load the value of field_discount in my module?

I made now a lot of research and I tried many different things, but nothing worked.


texts: Does the sitemap.xml file does from the xmlsitemap module actually get generated?

texts: I see that there is a 1.xml file generated in the sites/default/files/xmlsitemap folder, but I do not see a file in the Drupal root. However, when I call http://www.example.com/sitemap.xml I do get the info. Is this the normal behaviour?


texts: Reset password link yields Access Denied in Firefox

texts:
Our site is D6. Our users are having problems with the password reset/account verification function and it appears it currently appears to happen only in Firefox.

User applies for an account or asks for a password reset. They receive an email with a link to a one-time 24-hour password. They click the link and get a Password Reset page and a button to log in. When they press the login button, they get ACCESS DENIED.

This works fine in Safari and Chrome. It appears to be a Firefox issue (though truthfully this has been an on-again, off-again problem for years with Drupal no matter the version.)

We have explored a variety of drupal.org forum suggestions including commenting out the $cookie_domain = $_SERVER['HTTP_HOST']; in settings.php file ... or NOT commenting out that line and putting in $cookie_domain = "www.sitedomain.org"; or $cookie_domain = '.sitedomain.org'; ...

We also notice that in Firefox you can't seem to log out; you have to close Firefox to end the session. I bring this issue up because it appears related -- and it only happens in Firefox.

Your help would be ENORMOUSLY appreciated. This really hurts us and we can't figure it out.

thanks in advance.

(ALSO, if you could, we would love to know what your DRAFT set up was. It's great)

geoff


texts: How could I check that the field's value has indeed been modified?

texts: Is there a hook which could be used to execute code when a specific field of a custom content type is updated? Is there a specific hook, or should I use hook_node_presave()? In that case, how could I check that the field's value has indeed been modified?


texts: How to inject a product field to product display?

texts:
I have added a field on a product.I want the same field to appear on the product display that is being referenced.I need to do this with code.
How can I do this?
thanks


texts: Is it still a partial port or does it take a different approach?

texts:
At the moment of this question, I am using:

Drupal 8.1.3
Panels 8.x-3.0-beta4
Page Manager 8.x-1.0-alpha23
Layout plugin 8.x-1.0-alpha22

I am having difficulties replicating what was easy with Drupal 7, and I am not sure if the reason is simply that the ports of Panels and Page Manager are still incomplete, or that the approach has changed and I am not getting it.

In Drupal 7, you could create panels, and insert content into panes:

You could really add anything into a pane.

In Drupal 8, it looks like I can only add blocks:

What I want to achieve is being able to override a basic page (I'm overriding /node/{node}), and for example have a simple 1-column layout to display:

          <node title>

           <block 1>

          <node body>

           <block 2>

It could be more complex than that of course.

So, back to my question: is it just a matter of waiting for a complete port of Panels, or am I missing something?


texts: How to integrate a custom header and footer?

texts:
I need to add a custom header to a theme that I am currently building.
The only way I can seem to get the header and footer to show up on the page is to hard code it into the page.tpl.php file. I've tried to use the include trick, but that isn't working.
The header and the footer need to appear on every page.
Any help?


texts: determine which template file a contrib module is using?

texts:
I'm using a contrib module. It doesn't seem to be using the right template file. I'm trying to triage whether the problem exists in my template or if it is just the hook template suggestion.

What is the cheapest way to debug which template file a particular contrib module is using?

FYI: i'm using the commerce export ftp module. It has it's own template inside the module but i'd like it to use the template file within my theme.

I would like an answer that would be a general debugging practice. Not one specific to this particular module: how do you dump the file path that the contrib module is using? Is the only way of doing so with devel_ui ? I'm looking for a programatic way of doing this.


texts: Drupal Menu Page Callback Function went wrong with arguments

texts:
I am new to Drupal, and I was trying a small example from Book "Pro Drupal 7 Development", this is an example of basic menu system, here is code:

function menufun_menu() {
$items['menufun'] = array(
    'title' => 'Greeting',
    'page callback' => 'menufun_hello',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
);
return $items;
}

function menufun_hello($first_name = '', $last_name = '') {
return t('Hello, @first_name @last_name'，
    array('@first_name' => $first_name, '@last_name' => $last_name));
}

But I got HTTP 500 Error all the time:

  The website encountered an error while retrieving 'http://example.com/SampleDrupalSite/'. It may be down for maintenance or configured incorrectly.
  Here are some suggestions:
  Reload this webpage later.
  HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

When I tried function menufun_hello() without page callback arguments, it was all okay. Here is code without parameters:

    function menufun_hello() {
    return t('Hello!');
    }

May I ask what was wrong with this? (Plus, I've googled before I post it here).


texts: how to change teaser display output via views

texts:
I have a view that is displaying teasers of a content type. I would like to change order of one of the fields to come AFTER node links, any pointers?

Thanks.


texts: Add dividers for each year on View table

texts:
I have a view listing a custom content type by year and quarter (Spring, Summer, Fall, Winter). It's currently listed in a table. I'd like there to be dividers for each year within the table. Simply a row that names the year before going on to the content that fits within that year. Below is an image of the effect I want to achieve.

I've considered creating a twig template for the view, but I'm not sure how I would be able to check whether an item is the first or last item in a year. I've also considered adding a 'custom text' field but again I'm not sure how I'd make a conditional for that, and I'm not sure how I would be able to turn that into a unique row.

Is there a way to create row dividers in a table view once the year changes, or with any field for that matter?


texts:
Can I use the path() function in twig to create a link to a non-node entity add form. Taking the group module as an example, if I want to create a link to the 'group/add' page in twig can I use something like:

{{ path('entity.group.add') }}

I know that the above does not work, neither does

{{ path('group.add') }}

Not sure if there is a way to do this with the various twig functions that create links.


texts:
I have taxonomy terms for teams ( say team one , team two , etc ) and content types of teams that have team pictures of your team.

Im trying to figure out how to create a view that will show a player that selects team one as their team, and then show them on team one.

I have the view created and its a table, I just can't figure out how to get each player on each team.


texts: During checkout, when I click on review order, I would like to do some additional validation

texts:
When a user goes to checkout and clicks on "review", I would like to be able to hook into that process in order to do some custom validation.

How would I go about doing that?


texts: How to make base path available in views 3 Drupal 7?

texts:
Without use of Views PHP module, I need to use base_path for a link. Although using views_php module, we can add it inside php code but is there any way without using this module OR we'll have to write code to create something like handler.
Currently available fields in my module are following:

 Content: Add comment link
Display the standard add comment link used on regular nodes, which will only display if the viewing user has access to add a comment.
 Content: All taxonomy terms
Display all taxonomy terms associated with a node from specified vocabularies.
 Content: Author uid
The user authoring the content. If you need more fields than the uid add the content: author relationship
 Content: Body
Appears in: node:page, node:article, node:event_calendar.
 Content: Comment count
The number of comments a node has.
 Content: Comment status
Whether comments are enabled or disabled on the node.
 Content: Delete link
Provide a simple link to delete the content.
 Content: Edit link
Provide a simple link to edit the content.
 Content: Event Date
Appears in: node:event_calendar.
 Content: Event Status
Appears in: node:event_calendar.
 Content: Has new content
Show a marker if the content is new or updated.
 Content: Image
Appears in: node:article.
 Content: Last comment author
The name of the author of the last posted comment.
 Content: Last comment time
Date and time of when the last comment was posted.
 Content: Last comment uid
The User ID of the author of the last comment of a node.
 Content: Link
Provide a simple link to the content.
 Content: New comments
The number of new comments on the node.
 Content: Nid
The node ID.
 Content: Path
The aliased path to this content.
 Content: Post date
The date the content was posted.
 Content: Promoted to front page
Whether or not the content is promoted to the front page.
 Content: Published
Whether or not the content is published.
 Content: Sticky
Whether or not the content is sticky.
 Content: Title
The content title.
 Content: Type
The content type (for example, "blog entry", "forum post", "story", etc).
 Content: Updated date
The date the content was last updated.
 Content: Updated/commented date
The most recent of last comment posted or node updated time.
 Content revision: Delete link
Provide a simple link to delete the content revision.
 Content revision: Link
Provide a simple link to the revision.
 Content revision: Log message
The log message entered when the revision was created.
 Content revision: Revert link
Provide a simple link to revert to the revision.
 Content revision: Title
The content title.
 Content revision: Updated date
The date the node was last updated.
 Content revision: Vid
The revision ID of the content revision.
 File Usage: Entity ID
The ID of the entity that is related to the file.
 File Usage: Entity type
The type of entity that is related to the file.
 File Usage: Module
The module managing this file relationship.
 File Usage: Use count
The number of times the file is used by this entity.
 FullCalendar: Google Calendar
Display events from a Google Calendar.
 Global: Contextual Links
Display fields in a contextual links menu.
 Global: Custom text
Provide custom text or link.
 Global: Math expression
Evaluates a mathematical expression and displays it.
 Global: View result counter
Displays the actual position of the view result
 Scheduler: Publish countdown
Time until the article will be automatically published
 Scheduler: Publish on
Date/time on which the article will be automatically published
 Scheduler: Unpublish countdown
Time until the article will be automatically unpublished
 Scheduler: Unpublish on
Date/time on which the article will be automatically unpublished
 Search: Score
The score of the search item. This will not be used if the search filter is not also present.


texts: Which of these migration methods should I troubleshoot?

texts:
And are the problem's root causes the same? I've done a decent amount of research but the methods I've tried so far have failed. Backup and Migrate gave me this error when I imported the database only:

Notice: Undefined index: highlighted in include() (line 126 of /home/drupal7/public_html/drupal-test-site/modules/system/page.tpl.php).
Notice: Undefined index: sidebar_second in include() (line 144 of /home/drupal7/public_html/drupal-test-site/modules/system/page.tpl.php).
Notice: Undefined index: enabled in system_themes_page() (line 239 of /home/drupal7/public_html/drupal-test-site/modules/system/system.admin.inc).
Warning: uasort() expects parameter 1 to be array, null given in system_themes_page() (line 245 of /home/drupal7/public_html/drupal-test-site/modules/system/system.admin.inc).
Notice: Undefined index: adminimal in theme_get_setting() (line 1439 of /home/drupal7/public_html/drupal-test-site/includes/theme.inc).
Notice: Trying to get property of non-object in theme_get_setting() (line 1476 of /home/drupal7/public_html/drupal-test-site/includes/theme.inc).
Notice: Trying to get property of non-object in theme_get_setting() (line 1486 of /home/drupal7/public_html/drupal-test-site/includes/theme.inc).

It gave me this when I imported the full site:

Fatal error: Call to undefined function file_directory_path() in /home/drupal7/public_html/drupal-test-site/sites/all/modules/backup_migrate/includes/sources.archivesource.inc on line 211

Line 211 being

  // Move the files from the temp directory.
  if ($filepath && file_exists($filepath)) {
    _backup_migrate_move_files($filepath, file_directory_path());
  }
  else {
    _backup_migrate_message('Files were not restored because the archive did not seem to contain a files directory or was in a format that Backup and Migrate couldn\'t read', array(), 'warning');
  }

(I didn't get that _backup_migrate_message)

Doing the MySQL import manually gave me

Error
SQL query:

--
-- Dumping data for table `actions`
--

INSERT INTO `actions` (`aid`, `type`, `callback`, `parameters`, `label`) VALUES
('comment_publish_action', 'comment', 'comment_publish_action', '', 'Publish comment'),
('comment_save_action', 'comment', 'comment_save_action', '', 'Save comment'),
('comment_unpublish_action', 'comment', 'comment_unpublish_action', '', 'Unpublish comment'),
('node_make_sticky_action', 'node', 'node_make_sticky_action', '', 'Make content sticky'),
('node_make_unsticky_action', 'node', 'node_make_unsticky_action', '', 'Make content unsticky'),
('node_promote_action', 'node', 'node_promote_action', '', 'Promote content to front page'),
('node_publish_action', 'node', 'node_publish_action', '', 'Publish content'),
('node_save_action', 'node', 'node_save_action', '', 'Save content'),
('node_unpromote_action', 'node', 'node_unpromote_action', '', 'Remove content from front page'),
('node_unpublish_action', 'node', 'node_unpublish_action', '', 'Unpublish content'),
([...]

MySQL said:

#1062 - Duplicate entry 'comment_publish_action' for key 'PRIMARY'

I tried importing the database into a fresh one before installing but that gives me

Drupal already installed

To start over, you must empty your existing database.
To install to a different database, edit the appropriate settings.php file in the sites folder.
To upgrade an existing installation, proceed to the update script.
View your existing site.

I'm importing from a Windows 8.1 Bitnami install to a shared hosting account. I'm willing to migrate the theme files manually, all I care about automating is the modules and their configuration as configuring them takes a lot of time.


texts: Comments - Allow deletion of comments on your content without Administer Comments permission?

texts:
Is there a way to allow users to delete comments that are on their own content without giving access to Administer Comments?

Example:

Authenticated user makes a blog post (or some node content)
Another Authenticated user comments on it

Author does not like comment- wishes to delete.

The only option I have is edit/reply.


texts: how to mapping a field type in "Feeds module "?

texts:
In the first picture.
This "Pinboard helper module element" field type(the 1th red circle ) is make by a module .
The second picture is Feeds module . This field type can not show in the "TARGET menu".
(the 2th red circle )

Question:

How can make this field type(the 1th red circle ) show in the feeds Target(the 2th red circle ) ?
must write a module to use the "Pinboard" fields?


texts:
Today I uploaded my site to the server, and I get errors like the following:

  Unable to generate the derived image located at public://styles/sponsor_image/public/TerraThermaSponsorLogo.png.

Image styles cannot generate images. I have tried to set permissions on styles/* folders with chmod -R 775 styles/, and even tried chmod -R 777 styles/. The folder's owner is OK. I don't get what can be wrong.

The directory associated with public:// is sites/default/files, and it is OK.


texts: Leaflet Map disappears when selecting term in views exposed filter

texts:
I'm using leaflet in a content view with a page having an exposed filter on taxonomy terms.

Problem is whenever a term/filter is selected and applied the map disappears and turns grey.
I'm using Leaflet More Maps and this seems to happens with any map.


texts:
I set up my poll tpl file to include the poll fields (form, results, etc) along with a list at the bottom for the previous polls, ordered by date.  What I am trying to do is, from the main menu, link to the latest poll.  In other words, my current latest poll is node/123456/.  I can link to that, obviously.  But when we create a new one, that link needs to be updated.  I'd love to have it so the menu item doesn't need to be edited each time a new poll is created.

Any ideas?

UPDATE

Just so you don't think I'm waiting expecting you to write it for me - this is where I am:

$items['poll/latest'] = array(
    'title' => 'Latest Poll',
    'page callback' => 'latest_poll_find_poll',
    'access callback' => TRUE,
    'type' => MENU_NORMAL_ITEM,
  );

return $items;

/**
 * Find latest poll and redirect user
 */
function latest_poll_find_poll() {
  $nid = db_query('SELECT MAX(nid) AS nid FROM {node} WHERE type = "poll"')->fetchField();
  $latest = is_numeric($nid) ? 'node/' . $nid : '';
  drupal_goto($latest);
}


texts: Mandatory Group / Autosubscribe in Drupal 7

texts:
I'm using organic groups for a community website which notifies members when a new article is submitted to their group.

However I would like ALL members to receive notifications when the admins publish articles to the site.

There are 2 ideas on how I think this could be done:

Autosubscribe all users to receive notifications when articles are posted (to no group) by the admins
Have a 'General' group that all members automatically join on signup

I have seen a module for Drupal 6 which address idea 2 but so far I have not found any solution on Drupal 7.


texts: Landing page extension without 404 error

texts:
I have a problem concerning a landing page and 404 errors.

Context : I have a content type "news", with auto url /news/my-news-title. I have created programmatically a kind of homepage for news, with /news as URL

What's wrong : My problem is that if I have a link like /news/aiejaziejfnjdfnj (it doesn't exist), I don't have a 404 error and this is my /news landing page which is shown.
What I wish, with you help, is to have a 404 error when I have a non existant URL.

I'm going to show you what I have done, and hope sincerely you'll have an idea of what i'm doing wrong. In a custom module, I have :

function mymodule_menu(){
    $items = array();
    $items['news'] = array(
       'title' => "Les news",
       'page callback' => 'landing_page',
       'access arguments' => array('access content'),
    );
    return $items;
}
function landing_page(){
    return "nothing";
}

Then, I have a template page--news.tpl.php in which I have write things manually without showing $content (the "nothing").

So, why /news/aizejziej is accepted and is showing /news ? Is it function landing_page() which is doing something bad by always returning something ?

Thanks in advance for your help/ideas :)

Edit : Is it possible to create a node with /news as alias, and then theme it with page--node--[node-id].tpl.php (or kind of) ? I'll didn't have my bad hook_menu and landing_page thing...


texts: How do I disable caching for the Forum module or, alternatively, how do I fix caching?

texts:
I use the normal standard Drupal Forum module with a clean Drupal 8 installation. After I have installed it, I have a problem where "2 new posts" shows for all users. In other words, the /forum page is caching and showing the cached page of one user for the other user.

So I have two options

Disable caching for /forum <--- I don't mind doing this for now, as there aren't many users at the moment so I have time to fix this properly later.
Figure out why this page is caching the way it is. As mentioned, I am using a clean installation with hardly any confirm and this still happens.

Can someone confirm if the /forum page normally does this or if something is probably wrong with my installation? Or maybe I'm missing some setting? Or maybe caching is meant to be disabled for this to work?

Any help would be greatly appreciated!


texts: Remove entity type without module uninstall

texts:
I created entity type my_entity in my module. But now I don't need this entity anymore and I want to completely remove it without module's uninstall. I want to remove both definition and all database related tables or data. I thought about using \Drupal::entityDefinitionUpdateManager->uninstallEntityType('my_entity') in hook_update_N, but I can't use it because entity's definition will be removed.

Could anyone help me, and give advice how to delete both definition and database data?

UPD: I created an issue on drupal.org about this https://www.drupal.org/node/2655162


texts: Are there any modules for Profile2 revisioning/moderation

texts:
We're using Workbench moderation, and have a new requirement to add revisioning to the profile2 content. The primary reason for this is ensure that users' profile data has some degree of moderation before being made live.

If there is no current module solution for this, can anybody suggest the steps needed to create a module for this functionality.


texts: Why does Drupal say I need to upgrade to 8.0.0 beta 6 when I'm already checked out on that tag?

texts:
I followed the git instructions at: https://www.drupal.org/project/drupal/git-instructions to get Drupal 8 :

git clone --branch 8.0.x http://git.drupal.org/project/drupal.git .

I then checked out the tag for 8.0.0 beta 6:

git checkout tags/8.0.0-beta6

And this command confirms I'm on that tag:

$ git name-rev --tags --name-only $(git rev-parse HEAD)
8.0.0-beta6

I then prepared for the install: set up a blank database and user and then used this drush command to do the install:

drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://d8:d8@localhost/d8

When I go into the admin -  admin/reports/status - I'm told that I'm using 8.0.0-dev and that Unknown release date (version 8.0.0-beta6 available) is available.

But why? when I was already on 8.0.0-beta6 branch before I ran the install.


texts:
As the module devs isn't responding to posts like https://www.drupal.org/node/2032343 & https://www.drupal.org/node/2611824 I'm trying my luck here:

I've got a site sending emails via both rules and simplenews. I've got Mailjet, MailSystem and MimeMail installed. If I choose Mimemail in Mailsystem I can send HTML emails without problems - but even newsletter tests then ends up in spam. Plain text mails sent via Rules and Mailjet from my site is generally not seen as spam by email clients so I'd really like to use Mailjet as the mail system to improve delivery rates and get statistics.

Module versions:

core: 7.39
mailjet 7.x-2.6
mailsystem 7.x-2.34
mimemail 7.x-1.0-beta4
simplenews 7.x-1.1

My Mailjet module configuration isn't showing any errors and the test email confirms that the module is configured correctly.

I however have some issues:

when I use the Mailjet class in my MailSystem settings all html get's delivered as plain text.
Only number of emails delivered are showing at admin/mailjet/stats even though all tracking options are checked at admin/config/system/mailjet

Any ideas on how to use and track HTML in emails delivered by Mailjet?


texts: How to make Dynamic Term Link based on content type?

texts:
My web site has three content types ( Event, Course, Video) and 2 taxonomies(city and schools)
All of them have same taxonomy referenced field.
Eg:New York City events or New York City courses will be listed seperately.

Problem:
How can I make term links dynamic based on content type .

All new york city contents are listing(3 content type contents) if I clicked newyork city term on event content.

I need only event type contents to be listed if I came from an event type content. It should be changed according to  event,course or video content type.
Any help with this would be awesome . Thanks


texts: Has anyone worked on a built-in CLI terminal [w/ drush]?

texts:
What would make my experience with clients/end-users easier is if there was a self-contained GUI-like terminal that would be exclusive to their drupal 7 subsite in a multi-site configuration. This would allow them to be full-stack developers without the headache of managing *nix users?

The only reference I could find was for Drupal 6 - https://drupal.org/project/terminal.

In the meantime, the way I can think of manually achieving some of this is to write custom forms on a user dash (page--front.tpl.php) that would trigger drush calls on the server side for particular (custom) tasks. Maybe add some ajaxy for wiz-bang.

Now granted, a lot of the customs tasks I can think of atm can be achieved via drupal modules - such as editing css, limiting access to module uploads, and even exposing features. It's just turning each one of those on/off for over 100+ sites is cumbersome, and so it'd be nice to leave it up to the end-user to manage their own site.

Without paying Pantheon to do the same thing.


texts:
I am using waterwheel-swift to connect my iOS app to Drupal 8. Logging-in and node posting/editing work great, but when I try to post a comment, I get a 400 error.

I am using the following code.

    let body = [
        "entity_type": [
            [
                "value": "node"
            ]
        ],
        "entity_id": [
            [
                "target_id": self.nodeID
            ]
        ],
        "field_name": [
            [
                "value": "field_x"
            ]
        ],
        "comment_body": [
            [
                "value": "How are you?"
            ]
        ]
    ]

    waterwheel.entityPost(entityType: .Comment, params: body as paramType) { (success, response, json, error) in
        if (success) {
            print(response)
        } else {
            print(error)
        }
    }

I get the following error:

  Error Domain=Alamofire.AFError Code=3 "Response status code was unacceptable: 400."

rest.resource.entity.comment config is the following.

  langcode: en
  status: true
  dependencies:
    module:
      - basic_auth
      - comment
      - csv_serialization
      - hal
      - serialization
      - user
  id: entity.comment
  plugin_id: 'entity:comment'
  granularity: method
  configuration:
    GET:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
    POST:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
    DELETE:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
    PATCH:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie

Please point out if something is wrong with my code.


texts:
I'm attempting to perform a query to retrieve only the three most recent nodes of a certain content type.

$query = \Drupal::entityQuery('node')
    ->condition('type', 'blog_post')
    ->sort('field');
$nids = $query->execute();

I understand that I can use sort to specify the field I want the results to be sorted by. But how would I sort by the dates the nodes were published?